COLNEO Pro 1.0
Loading...
Searching...
No Matches
CoreAPI

Description

Core API interface.

This API bundles the core functionality. It is accessed via the API object 'cnCoreAPI'.

Since
1.0.0

(c) COLNEO GmbH

Functions

OBJECTS
ApiJsonResponse getObjects (QStringList &domains=QStringList()<< "geo", QString &filterexpression=QString())
 
ApiJsonResponse filterObjects (QStringList &objectIds, QVariant &filter)
 
ApiJsonResponse getObjectsByStatus (QString &status, bool statusFlag, QStringList &domains=QStringList()<< "all")
 
ApiJsonResponse createObject (QString &parentId, QVariantMap &data)
 
ApiJsonResponse createCube (QString &parentId, QList< double > &center, double a)
 
ApiJsonResponse deleteObjects (QStringList &objectIds)
 
HIERARCHIES / DOMAINS
ApiJsonResponse getParent (QString &objId)
 
ApiJsonResponse getChildren (QString &objId, int depth=0)
 
OBJECT PROPERTIES
ApiJsonResponse getPropertyValue (QStringList &objIds, QString &name, QString &xsDataType)
 
ApiJsonResponse setPropertyValue (QStringList &objIds, QString &name, QString &xsDataType, QVariant &value)
 
ApiJsonResponse getProperties (QString &objId, QVariantMap &filter=QVariantMap())
 
ApiJsonResponse setProperties (QStringList &objIds, QVariantMap &propertyMap)
 
PROPERTY TYPES
ApiJsonResponse getPropertyTypesByObject (QString &objId, QVariantMap &filter=QVariantMap())
 
ApiJsonResponse getPropertyTypeValues (QString &name, QString &xsDataType, QVariantMap &options=QVariantMap())
 
ApiJsonResponse getPropertyTypes ()
 
ApiJsonResponse createPropertyType (QVariantMap &data, bool updateExisting)
 
ApiJsonResponse deletePropertyType (QString &ptkeyAsString)
 
RELATIONS
ApiJsonResponse getLinkedObjects (QStringList &sourceIds, QVariantMap &options=QVariantMap())
 
ApiJsonResponse linkObjects (QStringList &sourceIds, QStringList &targetIds, QVariantMap &linkData=QVariantMap())
 
ApiJsonResponse unlinkObjects (QStringList &sourceIds)
 
OBJECT STATUS
ApiJsonResponse setVisible (QStringList &objIds, bool flag)
 
ApiJsonResponse isolate (QStringList &objIds, QVariantMap &config=QVariantMap())
 
ApiJsonResponse showAll ()
 
ApiJsonResponse toggleVisibility (QStringList &objIds)
 
ApiJsonResponse getVisible (QStringList &domains=QStringList()<< "all")
 
ApiJsonResponse isVisible (QString &objId)
 
ApiJsonResponse getSelected (QStringList &domains=QStringList()<< "all")
 
ApiJsonResponse setSelected (QStringList &objIds, bool flag)
 
ApiJsonResponse toggleSelection (QStringList &objIds)
 
ApiJsonResponse setSelectedOnly (QStringList &objIds)
 
ApiJsonResponse isSelected (QString &objId)
 
ApiJsonResponse clearSelection (QStringList &domains=QStringList()<< "all")
 
GEOMETRY
ApiJsonResponse getGeometry (QString &objId, QStringList &filter=QStringList())
 
ApiJsonResponse setGeometry (QString &objId, QVariantMap &geometryData)
 
SMART SETS
ApiJsonResponse getRootNodeOfSmartSetsByDomain (QString &domainCode)
 
ApiJsonResponse createSmartSet (QStringList &objIds, QStringList &propertyTypeKeys, QVariantMap &options=QVariantMap())
 
ApiJsonResponse updateSmartSet (QString &setId)
 
ApiJsonResponse createTreeStructure (QStringList &objIds, QVariantMap &schema, QString &treeRuleId=QString())
 
ApiJsonResponse updateTreeStructure (QString &smartSetId)
 
ApiJsonResponse createColorSchemaFromSmartSet (QString &setId, QVariantMap &options=QVariantMap())
 
ApiJsonResponse createStyles (QString &smartSetId, QVariantMap &options=QVariantMap())
 
ApiJsonResponse activateStyles (QString &smartSetId, QStringList &objIds=QStringList())
 
ApiJsonResponse resetStyles (QStringList &objIds=QStringList())
 
TOOLS

Events

STATUS NOTIFICATIONS
 selectionStateChanged ()
 
 visibilityStateChanged ()
 
 lockedStateChanged ()
 
 wireFrameStateChanged ()
 
 statusChanged (QString &statusType)
 
MISCELLANOUS NOTIFICATIONS
 progressChanged (QVariantMap &progressObject)
 

Function Documentation

◆ activateStyles

ApiJsonResponse activateStyles ( QString & smartSetId,
QStringList & objIds = QStringList() )
slot

Activate...

Parameters
smartSetIdId of smartset
objIds
Returns
...
Since
1.0.0

◆ clearSelection

ApiJsonResponse clearSelection ( QStringList & domains = QStringList()<< "all")
slot
Since
1.0.0

◆ createColorSchemaFromSmartSet

ApiJsonResponse createColorSchemaFromSmartSet ( QString & setId,
QVariantMap & options = QVariantMap() )
slot

...

Parameters
setIdID of smart set.
options...
Returns
Since
1.0.0

◆ createCube

ApiJsonResponse createCube ( QString & parentId,
QList< double > & center,
double a )
slot

Create a cube with the given edge length and center.

Parameters
parentIdId of parent object
centerCenter point of cube [x, y, z]
aEdge length of the cube
Remarks
Only for testing!

◆ createObject

ApiJsonResponse createObject ( QString & parentId,
QVariantMap & data )
slot

Create an object. If the parent does not fit (e.g. wrong domain), nothing happens.

Parameters
parentIdId of parent object
dataObject data given in JSON notation
{
info: {
object_type : "geo_container"
object_name : "MyObject",
//object_id : null,
},
properties: {
...
},
geometry: {
...
}
}
Returns
ID of the newly created object
data : string
Since
1.0.0

◆ createPropertyType

ApiJsonResponse createPropertyType ( QVariantMap & data,
bool updateExisting )
slot

Create a new property type.
Property types are identified by their name and datatype.
Values of properties can be restricted: To a selection (list entries) or the matching of a regular expression.

Parameters
data
Example 1:
{
name: "MyLength",
datatype: "xs:double",
unit: "m"
}
Example 2:
{
name: "TrafficLight",
datatype: "xs:string",
values: ["red", "yellow", "green"]
readOnly: true
}
updateExisting
Returns
Since
1.0.0

◆ createSmartSet

ApiJsonResponse createSmartSet ( QStringList & objIds,
QStringList & propertyTypeKeys,
QVariantMap & options = QVariantMap() )
slot

...

Parameters
objIdsList of object IDs.
propertyTypeKeysList of property type keys (name##xsdatatype)
optionsOptions
{
precision: 4,
intervalSize: null,
...
}
Returns
ID of root smart set container created
Since
1.0.0
Remarks
UNDER CONSTRUCTION

◆ createStyles

ApiJsonResponse createStyles ( QString & smartSetId,
QVariantMap & options = QVariantMap() )
slot

This method creates a distinc style (color) for each sub container of a given smart set

Parameters
smartSetId
options
Returns
Since
1.0.0

◆ createTreeStructure

ApiJsonResponse createTreeStructure ( QStringList & objIds,
QVariantMap & schema,
QString & treeRuleId = QString() )
slot

...

Parameters
objIdsList of object IDs.
schemaSchema as defined in cn_properties on infohub
treeRuleIdID of tree rule which should be applied. If empty, all trees will be created.
Returns
ID of root smart set containers created
Since
1.0.0

◆ deleteObjects

ApiJsonResponse deleteObjects ( QStringList & objectIds)
slot

Delete objects.

Parameters
objectIdsSingle object ID or list of object IDs.
Returns
Number of objects deleted
data : number
Since
1.0.0

◆ deletePropertyType

ApiJsonResponse deletePropertyType ( QString & ptkeyAsString)
slot

... Warning: if a property type is deleted, all properties with this key are removed from objects

Parameters
ptkeyAsString
Returns
Since
1.0.0

◆ filterObjects

ApiJsonResponse filterObjects ( QStringList & objectIds,
QVariant & filter )
slot

Filter objects.

Parameters
objectIdsBase object set. Apply filter to this set of objects. Single object ID or list of object IDs.
filterFilter condition. Each expression consist of [[operand1], [operator], [operand2]]
filter = {
options : {
case_sensitive: true
},
filter: [
[["ifc:Entity##xs:string"], ["match"], ["/^IfcWall$/g"]],
["AND"],
[["cn:Volume##xs:double"], [">="], [4.5]]
]
...
}
Returns
List of IDs of objects from the base set which matches the filter criteria
data : Array<string>
Since
1.0.0

◆ getChildren

ApiJsonResponse getChildren ( QString & objId,
int depth = 0 )
slot

Note
Usable with script properties

Get children of object with given id recursivly up to given depth.

Parameters
objIdID of the object
depth[optional] Recursion depth, default = 0 (maximum depth).
Returns
List of IDs of child objects.
data : Array<string>
Since
1.0.0

◆ getGeometry

ApiJsonResponse getGeometry ( QString & objId,
QStringList & filter = QStringList() )
slot

Get geometry data of object.
Vertices, triangles, triangle normal are provided as plain arrays.

Parameters
objId
filterList of keys which should be returned
['vertices', 'triangles', 'edges']
Returns
Object in JSON with geometric data.
{
"vertices": [
0.0, 0.0, 0.0,
1.0, 0.0, 0.0,
1.0, 1.0, 0.0,
0.0, 1.0, 0.0
],
"triangles": [
0, 1, 2,
2, 3, 0
}
"edges": [
0, 1,
1, 2,
2, 3,
3, 0
}
}
Since
1.0.0

◆ getLinkedObjects

ApiJsonResponse getLinkedObjects ( QStringList & sourceIds,
QVariantMap & options = QVariantMap() )
slot

Note
Usable with script properties

Get all objects linked to given objects.

Parameters
sourceIds
options
{
...
}
Returns
List of Ids
{
data: string
}
Since
1.0.0

◆ getObjects

ApiJsonResponse getObjects ( QStringList & domains = QStringList() << "geo",
QString & filterexpression = QString() )
slot

Note
Usable with script properties

Get objects.

Parameters
domainsDomain short code or combination as array, e.g. [ 'geo', 'act' ]
filterexpressionObject filter
"$ifc:Entity##xs:string ~like~ 'IfcWall%'"
Returns
List of object IDs.
data : Array<string>
Since
1.0

◆ getObjectsByStatus

ApiJsonResponse getObjectsByStatus ( QString & status,
bool statusFlag,
QStringList & domains = QStringList()<< "all" )
slot

Get object with given status in the specified domain(s). This is a more generic version of the methods getVisibleObjects(), getSelectedObjects(), ...

Parameters
statusOne of 'selected', 'visible', ...
statusFlagtrue or false
Returns
List of IDs of the objects with the given status in the specified domains.
data: Array<string>
Since
1.0.0

◆ getParent

ApiJsonResponse getParent ( QString & objId)
slot

Note
Usable with script properties

Get parent of object with given ID.

Parameters
objIdID of the object
Returns
ID of parent object, empty string if object has no parent
data : string
Since
1.0

◆ getProperties

ApiJsonResponse getProperties ( QString & objId,
QVariantMap & filter = QVariantMap() )
slot

Note
Usable with script properties

Get map of properties of a given object.

Note
Parameters
objIdID of the object.
filter[optional] Filter specification for getting properties. If defined the filter affects the name and data type of the fetched properties.
{
name: "MyNumber",
datatype : ["xs:double", "xs:float"]
}
Returns
Object with property type keys and values in JSON, e.g.:
data : {
"MyName##xs:string": "John",
"MyAge##xs:int": 42,
"IsMale##xs:boolean": true
}
Since
1.0.0

◆ getPropertyTypes

ApiJsonResponse getPropertyTypes ( )
slot

Get a list of all available property types.

!! CHECK AGAINST METHOD getPropertyTypeValues

Since
1.0.0

◆ getPropertyTypesByObject

ApiJsonResponse getPropertyTypesByObject ( QString & objId,
QVariantMap & filter = QVariantMap() )
slot

Get property types of an given object.

Parameters
objIdID of object.
filter[optional] Filter settings for getting property type. The filter the listed attributes (keys) of the fetched property types.
{
name: 'numb*',
datatypes: ['xs:double', 'xs:float']
readOnly: true
}
Returns
[
{
name: "cnName",
displayName: "cn:Name",
datatype: "xs:string",
readonly: true,
...
}
]
Since
1.0.0

◆ getPropertyTypeValues

ApiJsonResponse getPropertyTypeValues ( QString & name,
QString & xsDataType,
QVariantMap & options = QVariantMap() )
slot

Get property values of a given property type.

Parameters
nameName of property
xsDataTypeData type of property
options
{
objects: [...], // If the key is specified, only the listed objects are taken into account, otherwise all objects
precision: 0.0001, // applies only to floating point numbers
interval_size: 0, // applies only to numbers
interval_offset: 0, // applies only to numbers
date_grouping: 'week', // applies only to dates, one of ['day','week', 'month', 'year']
max_values: 0
}
Returns
List of unique property values
data : Array<any>
Since
1.0.0

◆ getPropertyValue

ApiJsonResponse getPropertyValue ( QStringList & objIds,
QString & name,
QString & xsDataType )
slot

Note
Usable with script properties

Get property value for a one or more objects and property type.

Parameters
objIdsObject ID or list of object IDs
nameName of property.
xsDataTypeDatatype of property, one of
  • 'xs:string'
  • 'xs:double'
  • 'xs:float'
  • 'xs:long'
  • 'xs:int'
  • 'xs:boolean'
  • 'xs:ID'
  • 'xs:IDREF'
  • 'xs:anyURI'
  • 'xs:dateTime'
  • 'xs:date'
  • 'xs:object'
Returns
Value of property, depending on the datatype. In case of xs:object JSON.parse() will be called internally and an javascript object returned.
data : simple datatype | object
Since
1.0.0

◆ getRootNodeOfSmartSetsByDomain

ApiJsonResponse getRootNodeOfSmartSetsByDomain ( QString & domainCode)
slot

...

Parameters
domainCode
Returns
Since
1.0.0

◆ getSelected

ApiJsonResponse getSelected ( QStringList & domains = QStringList()<< "all")
slot

Get objects with status 'selected'.

Parameters
domainsDomain short code or domain combination as array, e.g. ["geo, "act"]
Returns
List of IDs of selected objects.
data: Array<string>
Since
1.0.0

◆ getVisible

ApiJsonResponse getVisible ( QStringList & domains = QStringList()<< "all")
slot

Get objects with status 'visible'.

Parameters
domainsDomain short code or domain combination as array, e.g. ["geo, "act"]
Returns
List of IDs of the visible objects in the specified domains.
data: Array<string>
Since
1.0.0

◆ isolate

ApiJsonResponse isolate ( QStringList & objIds,
QVariantMap & config = QVariantMap() )
slot

Isolate objects (show only)

Parameters
objIds
configIsolation configuration :
{
"include_children" : true
}

◆ isSelected

ApiJsonResponse isSelected ( QString & objId)
slot

Check if an object is selected.

Parameters
objId
Returns
True, if object is visible, else false.
Since
1.0.0

◆ isVisible

ApiJsonResponse isVisible ( QString & objId)
slot

Check if an object is visible.

Parameters
objIdID of object
Returns
True, if object is visible, else false.
data: boolean | undefined
Since
1.0.0

◆ linkObjects

ApiJsonResponse linkObjects ( QStringList & sourceIds,
QStringList & targetIds,
QVariantMap & linkData = QVariantMap() )
slot

Link objects given in sourceIds to objects given in targetIds (link is bidirectional).

Parameters
sourceIdsID (string) or list of IDs (array)
targetIdsID (string) or list of IDs (array)
linkData...
{
}
Returns
number of linked objects
Since
1.0.0

◆ lockedStateChanged

lockedStateChanged ( )
signal

This signal is emitted when the locked state of objects has changed. Connect the signal to a javascript function after the web page is loaded.

cnCoreAPI.lockedStateChanged.connect(onLockedStateChanged);
...
function onLockedStateChanged() { // do sth... }
Since
1.0.0

◆ progressChanged

progressChanged ( QVariantMap & progressObject)
signal

...

Parameters
progressObject
{
value: 12,
message: "Reading properties...",
status: "ok"
}
Since

◆ resetStyles

ApiJsonResponse resetStyles ( QStringList & objIds = QStringList())
slot

...

Parameters
objIdsList with object IDs. If no list is passed, the style of all objects will be reset.
Returns
...
Since
1.0.0

◆ selectionStateChanged

selectionStateChanged ( )
signal

This signal is emitted when the selection state of objects has changed. Connect the signal to a javascript function (e.g. function onSelectionStateChanged) after the web page is loaded.

cnCoreAPI.selectionStateChanged.connect(onSelectionStateChanged);
...
function onSelectionStateChanged() { // do sth... }
Since
1.0.0

◆ setGeometry

ApiJsonResponse setGeometry ( QString & objId,
QVariantMap & geometryData )
slot

Set geometry data to an object.

Parameters
objId
geometryData
See also
getGeometry
Returns
True, if geometry could be set, else false (check errors)
data : boolean
Since
1.0.0

◆ setProperties

ApiJsonResponse setProperties ( QStringList & objIds,
QVariantMap & propertyMap )
slot

Set properties for one or more objects.

Parameters
objIdsObject ID or list of object IDs.
propertyMapMap with properties (key given in property type key notation name##xsDataType)
{
"myType##xs:string": "ABC",
"myNumber##xs:double": 1.234,
"myBoolean##xs:boolean": true
}
Returns
data : boolean
Since
1.0.0

◆ setPropertyValue

ApiJsonResponse setPropertyValue ( QStringList & objIds,
QString & name,
QString & xsDataType,
QVariant & value )
slot

Set a property value for one ore more objects.

Parameters
objIdsObject ID or list of object IDs.
nameName of property
xsDataTypeData type of property
valueProperty value (java script value). A value of null removes the property from the object.
If the data type is 'xs:date' or 'xs:dateTime', Date objects and ISO strings will be accepted as values. If the data type is 'xs:object', the array or object will be stored internally as json string.
Returns
True, if the property value could be set, else false. If false, take a look at the status code and message.
data : boolean
Since
1.0.0

◆ setSelected

ApiJsonResponse setSelected ( QStringList & objIds,
bool flag )
slot

...

Parameters
objIdsString (single ID) OR array of IDs.
flagtrue or false
Returns
Number of objects affected (should be equal to number of objIds)
Since
1.0.0

◆ setSelectedOnly

ApiJsonResponse setSelectedOnly ( QStringList & objIds)
slot
Since
1.0.0

◆ setVisible

ApiJsonResponse setVisible ( QStringList & objIds,
bool flag )
slot

...

Parameters
objIdsString (single ID) OR array of IDs.
flagtrue or false
Returns
Number of objects affected (should be equal to number of objIds)
data : number
Since
1.0.0

◆ showAll

ApiJsonResponse showAll ( )
slot

Set all objects visible.
This affects not only 3d-objects since objects in all domains have a status 'visible'

Since
1.0.0

◆ statusChanged

statusChanged ( QString & statusType)
signal

Generalisation of aboves method? To discuss ...

◆ toggleSelection

ApiJsonResponse toggleSelection ( QStringList & objIds)
slot
Since
1.0.0

◆ toggleVisibility

ApiJsonResponse toggleVisibility ( QStringList & objIds)
slot
Since
1.0.0

◆ unlinkObjects

ApiJsonResponse unlinkObjects ( QStringList & sourceIds)
slot

Remove all links form objects given by sourceIds.

Parameters
sourceIdsID (string) or list of IDs (array)
Returns
Number of links removed.
Since
1.0.0

◆ updateSmartSet

ApiJsonResponse updateSmartSet ( QString & setId)
slot

...

Parameters
setIdID of the smart set
Returns
ID of root smart set container created
Since
1.0.0

◆ updateTreeStructure

ApiJsonResponse updateTreeStructure ( QString & smartSetId)
slot
Parameters
smartSetIdID of root smart set

◆ visibilityStateChanged

visibilityStateChanged ( )
signal

This signal is emitted if the visibility state of objects has changed. Connect the signal to a javascript function after the web page is loaded.

cnCoreAPI.visibilityStateChanged.connect(onVisibilityStateChanged);
...
function onVisibilityStateChanged() { // do sth... }
Since
1.0.0

◆ wireFrameStateChanged

wireFrameStateChanged ( )
signal

This signal is emitted when the wire frame state of objects has changed. Connect the signal to a javascript function after the web page is loaded.

cnCoreAPI.wireFrameStateChanged.connect(onWireFrameStateChanged);
...
function onWireFrameStateChanged() { // do sth... }
Since
1.0.0