Class Data

Note

You have to include the header Data.h.

class Data

Data of a node.

Throws

Error − In any of these commands, if the communication is off, the following error code will be reported ErrorCode::CommunicationError.

// Get the first node of a graph
InstantTerra instantTerra = CreateInstantTerra();
Project project = instantTerra.GetProject();
Graph graph = project.GetGraph();
Node firstNode = graph.GetNode(0);
Connector firstConnector = firstNode.GetConnector(0);

Data data = firstNode.GetData(firstConnector);

DataType Data::GetType()

Returns the type of data.

int Data::GetWidth()

Returns Terrain / Mask / color map / color map width.

Throws

Error − If the data is not of the type [Terrain, Mask, ColorMap, VectorMap], the following error code will be reported ErrorCode::DataIsNotAGrid.

int Data::GetHeight()

Returns Terrain / Mask / color map / color map height.

Throws

Error − If the data is not of the type [Terrain, Mask, ColorMap, VectorMap], the following error code will be reported ErrorCode::DataIsNotAGrid.

void Data::GetFloatContent(float *buffer, int bufferSize, int startingX, int startingY, int width, int height, int resolution)


Returns, in a float buffer, the content of the terrain or mask.

Warning

The size of the buffer should be superior or egal to width * height * sizeof(float).

Values startingX and startingY are the top left point coordinates of the part you want to get.

You can choose between multiple resolutions:

  • 0: Full resolution

  • 1: Half resolution

  • 2: Quarter resolution

Throws

Error − If the data is not of the type [Terrain, Mask], the following error code will be reported ErrorCode::DataIsNotATerrainOrMask.

void Data::ForceDataToBeComputed()

Force data to be computed.

int Data::GetResolution(bool &completed, int startingX, int startingY, int width, int height)

Get the currently computed resolution of a part of a terrain, a mask, a color map or a color map.
Return value:
0 = all points have been computed (full resolution).
1 = one point every 2 points has been computed (half resolution).
2 = one point every 4 points has been computed (quarter resolution).
Etc.
The method returns NOT_COMPUTED if this part of the grid has not been computed yet.
completed is set to true if the computation is completed.
completed is set to false if the computation is not completed, for instance because there is an erosion node that is currently been computed. (modifié)
startingX, startingY: coordinates in points of the top left region to test.
width, height: size in points of the region to test.

Error The following error code may be reported ErrorCode::DataIsNotAGrid.

const Data::NOT_COMPUTED

NOT_COMPUTED is a constant equal to -1.


Copyright © 2022 · All Rights Reserved · Wysilab