Space Objects - API Inteface & Guides
The CADViewer Space Object API and Interface is developed to:
1) Use geometrical elements in CAD files, such as polygons on layers, and block attributes, and give then “life” (click-handers and API interaction) through our back-end AutoXchange Conversion process. For this, please read the guide:
- Guide - How to create hotspots in drawings
- Guide - Add Or Modify Hotspots & Images
- Guide - Style Hotspots & Images
And the associated processing on the CAD converter AutoXchange back-end:
2) Through the CADViewer interface command to dynamically add and manipulate Space Objects. See the Interface API command list for Space Objects activated through the Icon menu or user activated.
3) Allow users to build custom menu with Space Object (Assets) loaded from a server side Configuration File. Images for Space Objects can be SVG or bitmaps (png, jpg, gif). Space Objects created in Inkscape can be dynamically controlled, see Inkscape State Layers for IWMS.
This Space Objects - API Interace & Guides document will now describe the API commands available for Space Object Manipulation.
Callback method for Space Object interaction
When interacting with Space Objects, one of the most useful methods is the Callback method cvjs_graphicalObjectOnChange which captures any creation, edition or interaction on a Space Object:
Space Objects JSON Commands
Each Space Object is kept in a JSON structure that contains information about the object. The Space Object can be created at load time through a processing of the CAD files, see above Guide - How to create hotspots in drawings and the associated processing on the CAD converter AutoXchange back-end, Database Linkage.
A JSON Space Object can be created with the API command cvjs_createNewJSonSpaceObject() , please see the guide on JSON structure:
Note that an ‘customContent’ tag has been introduced to the Space Object that allows application programmers to add higher level content to their individual Space Object.
See the list of API commands for JSON structures:
General Space Object Creation Methods:
Space Objects can be created in two ways:
1: Set the parameters for insertion and scale in separate methods, then insert the Space Object
2: or first create a higher level JSON object with parameter and scale information and insert the Space Object .
Replace Space Object(s):
- cvjs_replaceSpaceObjectPathWithImage() - overlay an SVG/image on top of existing Space Object
Operations on Space Objects
Below are a number of operations to modify or update Space Objects, as well as extracting information from them.
- Layer Operations on Space Objects
- Highlight Operations on Space Objects
- Query on Space Objects
- Modification of Space Objects
Rules Based Space Management API
The CADViewer Space Management API provides a set of methods that allows application programmers to determine how spaces on the canvas relates to each others when inserting or moving content on the canvas.
The CADViewer Rules Based Space Management API uses the ‘customContent’ tag in the Space Object, that allows application programmers to add higher level content to the Space Object.
See the Guide: