C++/CLI Sample
Demonstrates how to create a C++/CLI library using the VideoXpert SDK
CPPCli::Drawing Class Reference

The Drawing class represents a diagrammatic representation of an area. A drawing may contain any number of markers to represent points of interest within the area. More...

#include <Drawing.h>

Public Member Functions

 Drawing (VxSdk::IVxDrawing *vxDrawing)
 Constructor. More...
 
virtual ~Drawing ()
 Destructor. More...
 
 !Drawing ()
 Finaliser. More...
 
Results::Value AddMarker (NewMarker^ newMarker)
 Creates a new marker. More...
 
Results::Value DeleteImage ()
 Deletes the binary drawing image data. More...
 
Results::Value DeleteLock ()
 Deletes the resource lock, if any. More...
 
Results::Value DeleteMarker (Marker^ marker)
 Deletes a marker. More...
 
System::String^ GetImageUri ()
 Gets the image uri, if any. More...
 
ResourceLockGetLock ()
 Gets the resource lock, if any. More...
 
Results::Value Refresh ()
 Refreshes this instances properties. More...
 
Results::Value SetImage (System::String^ imagePath)
 Sets the binary drawing image data. The maximum allowable size of the image is 128 MB. Supported file types are DWG, JPG and PNG. More...
 
Results::Value SetLock ()
 Sets a resource lock on this drawing, owned by the current user. More...
 

Package Functions

System::Collections::Generic::List< Marker^ >^ _GetMarkers ()
 

Package Attributes

VxSdk::IVxDrawing_drawing
 

Properties

System::String^  Id [get]
 Gets the unique drawing identifier. More...
 
System::Collections::Generic::List< Marker^ >^ Markers [get]
 Gets the markers associated with this drawing. More...
 
System::String^  Name [get, set]
 Gets or sets the friendly name. More...
 

Detailed Description

The Drawing class represents a diagrammatic representation of an area. A drawing may contain any number of markers to represent points of interest within the area.

Definition at line 17 of file Drawing.h.

Constructor & Destructor Documentation

CPPCli::Drawing::Drawing ( VxSdk::IVxDrawing vxDrawing)

Constructor.

Parameters
vxDrawingThe vx Drawing.

Definition at line 8 of file Drawing.cpp.

8  {
9  _drawing = vxDrawing;
10 }
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
virtual CPPCli::Drawing::~Drawing ( )
inlinevirtual

Destructor.

Definition at line 29 of file Drawing.h.

29  {
30  this->!Drawing();
31  }
Drawing(VxSdk::IVxDrawing *vxDrawing)
Constructor.
Definition: Drawing.cpp:8
CPPCli::Drawing::!Drawing ( )

Finaliser.

Definition at line 12 of file Drawing.cpp.

12  {
13  _drawing->Delete();
14  _drawing = nullptr;
15 }
virtual VxResult::Value Delete() const =0
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129

Member Function Documentation

System::Collections::Generic::List< CPPCli::Marker^ > CPPCli::Drawing::_GetMarkers ( )
package

Definition at line 98 of file Drawing.cpp.

98  {
99  // Create a list of managed marker objects
100  List<CPPCli::Marker^>^ mlist = gcnew List<CPPCli::Marker^>();
101  // Create a collection of unmanaged marker objects
103 
104  // Make the GetMarkers call, which will return with the total marker count, this allows the client to allocate memory.
105  VxSdk::VxResult::Value result = _drawing->GetMarkers(markers);
106  // Unless there are no markers on the system, this should return VxSdk::VxResult::kInsufficientSize
107  if (result == VxSdk::VxResult::kInsufficientSize) {
108  // Allocate enough space for the IVxMarker collection
109  markers.collection = new VxSdk::IVxMarker*[markers.collectionSize];
110  result = _drawing->GetMarkers(markers);
111  // The result should now be kOK since we have allocated enough space
112  if (result == VxSdk::VxResult::kOK) {
113  for (int i = 0; i < markers.collectionSize; i++)
114  mlist->Add(gcnew CPPCli::Marker(markers.collection[i]));
115  }
116  // Remove the memory we previously allocated to the collection
117  delete[] markers.collection;
118  }
119  return mlist;
120 }
The Marker class represents the location of a resource on a drawing.
Definition: Marker.h:15
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
virtual VxResult::Value GetMarkers(VxCollection< IVxMarker ** > &markerCollection) const =0
CPPCli::Results::Value CPPCli::Drawing::AddMarker ( NewMarker newMarker)

Creates a new marker.

Parameters
newMarkerThe new marker to be added.
Returns
The Result of the request.

Definition at line 17 of file Drawing.cpp.

17  {
18  // Create a new marker object and populate its fields using newMarker
19  VxSdk::VxNewMarker vxNewMarker;
20  VxSdk::Utilities::StrCopySafe(vxNewMarker.associatedDataSourceId, Utils::ConvertSysString(newMarker->AssociatedDataSourceId));
21  VxSdk::Utilities::StrCopySafe(vxNewMarker.name, Utils::ConvertSysString(newMarker->Name));
22  vxNewMarker.direction = newMarker->Direction;
23  vxNewMarker.x = newMarker->X;
24  vxNewMarker.y = newMarker->Y;
25 
26  // Make the call to add the marker to the drawing
27  VxSdk::VxResult::Value result = _drawing->AddMarker(vxNewMarker);
28  // Unless there was an issue creating the marker the result should be VxSdk::VxResult::kOK
29  return CPPCli::Results::Value(result);
30 }
virtual VxResult::Value AddMarker(VxNewMarker &newMarker) const =0
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
char associatedDataSourceId[64]
static void StrCopySafe(char(&dst)[dstSize], const char *src)
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
static const char * ConvertSysString(System::String^ sysString)
Convert a system string to a char.
Definition: Utils.h:233
CPPCli::Results::Value CPPCli::Drawing::DeleteImage ( )

Deletes the binary drawing image data.

Returns
The Result of deleting the image.

Definition at line 32 of file Drawing.cpp.

32  {
34 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value DeleteImage() const =0
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
CPPCli::Results::Value CPPCli::Drawing::DeleteLock ( )

Deletes the resource lock, if any.

Returns
The Result of deleting the lock.

Definition at line 36 of file Drawing.cpp.

36  {
37  // Get the lock for this drawing
38  VxSdk::IVxResourceLock* lock = nullptr;
39  VxSdk::VxResult::Value result = _drawing->GetLock(lock);
40 
41  // Delete the lock if present
42  if (result == VxSdk::VxResult::kOK && lock != nullptr)
44 
45  return (CPPCli::Results::Value)result;
46 }
virtual VxResult::Value GetLock(IVxResourceLock *&resourceLock) const =0
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value DeleteResourceLock() const =0
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
CPPCli::Results::Value CPPCli::Drawing::DeleteMarker ( Marker marker)

Deletes a marker.

Parameters
markerThe marker to be deleted.
Returns
The Result of the request.

Definition at line 48 of file Drawing.cpp.

48  {
49  return (CPPCli::Results::Value)marker->_marker->DeleteMarker();
50 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
System::String CPPCli::Drawing::GetImageUri ( )

Gets the image uri, if any.

Returns
The the image uri.

Definition at line 52 of file Drawing.cpp.

52  {
53  char* imageEndpoint = nullptr;
54  int size = 0;
55 
56  // If the rtsp uri is not available on the datasource the result will return VxSdk::VxResult::kActionUnavailable,
57  // otherwise VxSdk::VxResult::kInsufficientSize
58  VxSdk::VxResult::Value result = _drawing->GetImage(imageEndpoint, size);
59  if (result == VxSdk::VxResult::kInsufficientSize) {
60  // Allocate enough space for rtspEndpoint
61  imageEndpoint = new char[size];
62  // The result should now be kOK since we have allocated enough space
63  _drawing->GetImage(imageEndpoint, size);
64  }
65  return gcnew System::String(imageEndpoint);
66 }
virtual VxResult::Value GetImage(char *endpoint, int &size) const =0
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
CPPCli::ResourceLock CPPCli::Drawing::GetLock ( )

Gets the resource lock, if any.

Returns
The Result of the request.

Definition at line 68 of file Drawing.cpp.

68  {
69  // Get the lock for this drawing
70  VxSdk::IVxResourceLock* lock = nullptr;
71  VxSdk::VxResult::Value result = _drawing->GetLock(lock);
72 
73  // Return the lock if present
74  if (result == VxSdk::VxResult::kOK && lock != nullptr)
75  return gcnew CPPCli::ResourceLock(lock);
76 
77  return nullptr;
78 }
virtual VxResult::Value GetLock(IVxResourceLock *&resourceLock) const =0
The ResourceLock class represents a lock upon a resource. A resource that has been locked shall permi...
Definition: ResourceLock.h:15
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
CPPCli::Results::Value CPPCli::Drawing::Refresh ( )

Refreshes this instances properties.

Returns
The Result of updating the properties.

Definition at line 80 of file Drawing.cpp.

80  {
82 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value Refresh()=0
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
CPPCli::Results::Value CPPCli::Drawing::SetImage ( System::String^  imagePath)

Sets the binary drawing image data. The maximum allowable size of the image is 128 MB. Supported file types are DWG, JPG and PNG.

Parameters
imagePathThe local path to the image file.
Returns
The Result of the request.

Definition at line 84 of file Drawing.cpp.

84  {
85  // Copy the image path to a new char
86  int len = imagePath->Length + 1;
87  char* image = new char[len];
89 
90  // Set the image path
92 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value SetImage(char *imagePath) const =0
static void StrCopySafe(char(&dst)[dstSize], const char *src)
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129
static const char * ConvertSysString(System::String^ sysString)
Convert a system string to a char.
Definition: Utils.h:233
CPPCli::Results::Value CPPCli::Drawing::SetLock ( )

Sets a resource lock on this drawing, owned by the current user.

Returns
The Result of the request.

Definition at line 94 of file Drawing.cpp.

94  {
96 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value SetLock() const =0
VxSdk::IVxDrawing * _drawing
Definition: Drawing.h:129

Member Data Documentation

VxSdk::IVxDrawing* CPPCli::Drawing::_drawing
package

Definition at line 129 of file Drawing.h.

Property Documentation

System:: String^ CPPCli::Drawing::Id
get

Gets the unique drawing identifier.

The unique identifier.

Definition at line 100 of file Drawing.h.

System:: Collections:: Generic:: List< Marker^>^ CPPCli::Drawing::Markers
get

Gets the markers associated with this drawing.

A List of the associated markers.

Definition at line 109 of file Drawing.h.

System:: String^ CPPCli::Drawing::Name
getset

Gets or sets the friendly name.

The friendly name.

Definition at line 118 of file Drawing.h.


The documentation for this class was generated from the following files: