MCPcopy Create free account
hub / github.com/OpenWebCAD/node-occ / extract_shapes_as_javascript_array

Function extract_shapes_as_javascript_array

src/Shape.h:31–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30template <class SHAPE>
31inline v8::Local<v8::Array> extract_shapes_as_javascript_array(SHAPE* pThis,TopAbs_ShapeEnum type) {
32
33 TopTools_IndexedMapOfShape anIndices;
34 TopExp::MapShapes(pThis->shape(), type, anIndices);
35
36 int nb =anIndices.Extent();
37 v8::Local<v8::Array> arr = Nan::New<v8::Array>(nb);
38 for (int i=0; i<nb; i++) {
39 v8::Local<v8::Object> obj= buildWrapper(anIndices(i+1)); // 1 based !!!
40 Nan::Set(arr,i,obj);
41 }
42 return arr;
43}
44
45
46

Callers 4

NAN_METHODFunction · 0.85
NAN_METHODFunction · 0.85
NAN_METHODFunction · 0.85
NAN_METHODFunction · 0.85

Calls 1

buildWrapperFunction · 0.85

Tested by

no test coverage detected