Polyline Functions

Functions:

MTK_Object_Polyline_AppendPoint

int MTK_Object_Polyline_AppendPoint(
			MTK_Object* obj,
			const double& x, const double& y,
			const double& z, const double& w,
			const int& t, const char* name
			);
		

Description

Append a point to an object.

Parameters

obj

pointer to an MTK_Object struct

x

the x coordinate of the point (double)

y

the y coordinate of the point (double)

z

the z coordinate of the point (double)

w

the w value of the point (double)

t

the type of the point (int)

Note: points types documented at MTK_Object_Polyline_GetPointType

name

the name of the point (const char*)

Return Value

0

success

other

failure

MTK_Object_Polyline_DeleteAllPoints

int MTK_Object_Polyline_DeleteAllPoints(MTK_Object* obj);
		

Description

Delete all points in a polyline object.

Parameters

obj

pointer to an MTK_Object struct

Return Value

0

success

other

failure

MTK_Object_Polyline_DeletePoint

int MTK_Object_Polyline_DeletePoint(MTK_Object* obj, const int& index);
		

Description

Delete a point in a polyline object.

Parameters

obj

pointer to an MTK_Object struct

index

the index of the point (int)

Return Value

0

success

other

failure

MTK_Object_Polyline_GetAttributes

int MTK_Object_Polyline_GetAttributes(
			MTK_Object* obj,
			int* linetype, int* pattern,
			int* clockwise, int* closed
			);
		

Description

Get the polyline attributes of a polyline object.

Parameters

obj

pointer to an MTK_Object struct

linetype

the linetype of the object (int*)

Note: linetypes are documented in MTK_Object_Polyline_GetLineType.

pattern

the pattern of the object (int*)

clockwise

whether the object is clockwise or not (int*)

closed

whether the object is closed or not (int*)

Return Value

0

success

other

failure

MTK_Object_Polyline_GetLineType

int MTK_Object_Polyline_GetLineType(MTK_Object* obj, int* type);
		

Description

Get the type (style and thickness) of the line of a polyline object.

Parameters

obj

pointer to an MTK_Object struct

type

the type of line (int*) as (style + (thickness - 1) * 10)

style is different dashing styles from 0 to 7

thickness is different line thickness from 1 to 10

Return Value

0

success

other

failure

MTK_Object_Polyline_GetPointInfo

int MTK_Object_Polyline_GetPointInfo(
			MTK_Object* obj, const int& index,
			double* x, double* y, double* z,
			double* w, int* t, char* name
			);
		

Description

Get the information about a point in a polyline object.

Parameters

obj

pointer to an MTK_Object struct

index

the index of the point (int)

x

the x coordinate of the point (double*)

y

the y coordinate of the point (double*)

z

the z coordinate of the point (double*)

w

the w value of the point (double*)

t

the type of the point (int*)

Note: point types are documented in MTK_Object_Polyline_GetPointType

name

buffer of length MTK_BUFFER_SIZE to receive the name of the point, if any (char*)

Return Value

0

success

other

failure

MTK_Object_Polyline_GetPointType

int MTK_Object_Polyline_GetPointType(MTK_Object* obj, const int& index, int* t);
		

Description

Get the type of a point in a polyline object.

Parameters

obj

pointer to an MTK_Object struct

index

the index of the point (int)

t

the type of the point  (int*)

Possible Point Types:

0

"move"  - no line is drawn from this point

1

"draw"  - a line is drawn from this point

2

"point" - this point is unconnected to any other point

Return Value

0

success

other

failure

MTK_Object_Polyline_NPoints

int MTK_Object_Polyline_NPoints(MTK_Object* obj);
		

Description

Get the number of points in a polyline object.

Parameters

obj

pointer to an MTK_Object struct

Return Value

int

number of points in the object

-1

failed

MTK_Object_Polyline_SetAttributes

int MTK_Object_Polyline_SetAttributes(
			MTK_Object* obj,
			const int& linetype, const int& pattern,
			const int& clockwise, const int& closed
			);
		

Description

Set the polyline attributes of a polyline object. Passing a -1 will skip setting that attribute.

Parameters

obj

pointer to an MTK_Object struct

linetype

the linetype of the object (int)

Note: linetypes documented at MTK_Object_Polyline_GetLineType

pattern

the pattern of the object (int)

clockwise

whether the object is clockwise or not (int)

closed

whether the object is closed or not (int)

Return Value

0

success

other

failure

Example

// MTK_Object_Polyline_SetAttributes Example
int main()
{
	int status;
	// Authorisation code
	// Get an MTK_Object* that is a DESIGN_POLYLINE
	status = MTK_Object_Polyline_SetAttributes(
		object,
		-1, // Leave linetype alone
		-1, // Leave pattern alone
		-1, // Leave orientation alone
		1   // Set 'closed' to true
	);
	if (status)
	{
		char error[MTK_BUFFER_SIZE];
		MTK_API_GetError(error);
		printf("%s\n", error);
		return 1;
	}
// Save the MTK_Object*
return 0;
}

MTK_Object_Polyline_SetLineType

int MTK_Object_Polyline_SetLineType(MTK_Object* obj, const int& type);
		

Description

Set the type of the line of a polyline object.

Parameters

obj

pointer to an MTK_Object struct

type

the type of line (int)

Possible Line Types :

style + (thickness-1)*10

style ranges from 0 to 7

thickness ranges from 1 to 10

Return Value

0

success

other

failure

MTK_Object_Polyline_SetPointInfo

int MTK_Object_Polyline_SetPointInfo(
			MTK_Object* obj, const int& index,
			const double& x, const double& y, const double& z,
			const double& w, const int& t, const char* name
			);
		

Description

Set the information about a point in a polyline object.

Parameters

obj

pointer to an MTK_Object struct

index

the index of the point        (int)

x

the x coordinate of the point (double)

y

the y coordinate of the point (double)

z

the z coordinate of the point (double)

w

the w value of the point (double)

t

the type of the point (int)

Note: point types are documented in MTK_Object_Polyline_GetPointType

name

the name of the point (const char*)

Return Value

0

success

other

failure

MTK_Object_Polyline_SetPointType

int MTK_Object_Polyline_SetPointType(
			MTK_Object* obj,
			const int& index, const int& t
			);
		

Description

Set the type of a point in a polyline object.

Parameters

obj

pointer to an MTK_Object struct

index

the index of the point (int)

t

the type of the point  (int)

Possible Point Types:

0

"move"  - no line is drawn from this point

1

"draw"  - a line is drawn from this point

2

"point" - this point is unconnected to any other point

Return Value

0

success

other

failure