void getRGB_shapeRepresentation(int model, int ifcShapeRepresentationInstance, STRUCT__OBJECT__COLOR ** ppObjectColor) { #ifdef _UNICODE wchar_t * pRepresentationIdentifier = 0, * RepresentationType = 0; sdaiGetAttrBN(ifcShapeRepresentationInstance, (char *) L"RepresentationIdentifier", sdaiUNICODE, &pRepresentationIdentifier); sdaiGetAttrBN(ifcShapeRepresentationInstance, (char *) L"RepresentationType", sdaiUNICODE, &RepresentationType); #else char * pRepresentationIdentifier = 0, * RepresentationType = 0; sdaiGetAttrBN(ifcShapeRepresentationInstance, "RepresentationIdentifier", sdaiSTRING, &pRepresentationIdentifier); sdaiGetAttrBN(ifcShapeRepresentationInstance, "RepresentationType", sdaiSTRING, &RepresentationType); #endif #ifdef _UNICODE if ( (Equals(pRepresentationIdentifier, L"Body") || Equals(pRepresentationIdentifier, L"Mesh") || Equals(pRepresentationIdentifier, L"Facetation")) && !Equals(RepresentationType, L"BoundingBox") ) #else if ( (Equals(pRepresentationIdentifier, "Body") || Equals(pRepresentationIdentifier, "Mesh") || Equals(pRepresentationIdentifier, "Facetation")) && !Equals(RepresentationType, "BoundingBox") ) #endif { int * geometry_set = 0, geometry_cnt, i = 0; #ifdef _UNICODE sdaiGetAttrBN(ifcShapeRepresentationInstance, (char *) L"Items", sdaiAGGR, &geometry_set); #else sdaiGetAttrBN(ifcShapeRepresentationInstance, "Items", sdaiAGGR, &geometry_set); #endif geometry_cnt = sdaiGetMemberCount(geometry_set); // i = geometry_cnt; // while (i > 0) { // i--; i = 0; while (i < geometry_cnt) { int geometryInstance = 0, styledItemInstance = 0; engiGetAggrElement(geometry_set, i, sdaiINSTANCE, &geometryInstance); //ASSERT((*ppObjectColor) == 0); if ((*ppObjectColor) != 0) return; (*ppObjectColor) = newObjectColor(geometryInstance); #ifdef _UNICODE sdaiGetAttrBN(geometryInstance, (char *) L"StyledByItem", sdaiINSTANCE, &styledItemInstance); #else sdaiGetAttrBN(geometryInstance, "StyledByItem", sdaiINSTANCE, &styledItemInstance); #endif if (styledItemInstance != 0) { //int expressID = internalGetP21Line(geometryInstance); getRGB_styledItem(model, styledItemInstance, (*ppObjectColor)->itemColor); } else { searchDeeper(model, geometryInstance, ppObjectColor, (*ppObjectColor)->itemColor); } ppObjectColor = &(*ppObjectColor)->next; i++; } } }
void getRGB_productDefinitionShape(int model, int ifcObjectInstance, STRUCT__OBJECT__COLOR ** ppObjectColor) { int * representations_set = NULL, representations_cnt, i = 0; #ifdef _UNICODE sdaiGetAttrBN(ifcObjectInstance, (char *) L"Representations", sdaiAGGR, &representations_set); #else sdaiGetAttrBN(ifcObjectInstance, "Representations", sdaiAGGR, &representations_set); #endif representations_cnt = sdaiGetMemberCount(representations_set); while (i < representations_cnt) { int ifcShapeRepresentation = 0; engiGetAggrElement(representations_set, i, sdaiINSTANCE, &ifcShapeRepresentation); if (ifcShapeRepresentation != 0) { getRGB_shapeRepresentation(model, ifcShapeRepresentation, ppObjectColor); } i++; } }
void getRGB_styledItem(int model, int ifcStyledItemInstance, STRUCT__ITEM__COLOR * itemColor) { int * styles_set = 0, styles_cnt, i = 0; #ifdef _UNICODE sdaiGetAttrBN(ifcStyledItemInstance, (char *) L"Styles", sdaiAGGR, &styles_set); #else sdaiGetAttrBN(ifcStyledItemInstance, "Styles", sdaiAGGR, &styles_set); #endif styles_cnt = sdaiGetMemberCount(styles_set); while (i < styles_cnt) { int presentationStyleAssignmentInstance = 0; engiGetAggrElement(styles_set, i, sdaiINSTANCE, &presentationStyleAssignmentInstance); if (presentationStyleAssignmentInstance != 0) { getRGB_presentationStyleAssignment(model, presentationStyleAssignmentInstance, itemColor); } i++; } }
void CIFCEngineInteract::retrieveObjects(char * ObjectSPFFName, char * ObjectGroupName) { STRUCT_INSTANCES * parent; int i, object, * objects, noObjects; char * string; objects = sdaiGetEntityExtentBN(g_model, ObjectSPFFName); noObjects = sdaiGetMemberCount(objects); if (noObjects) { parent = addObject(NULL, 0, ObjectGroupName); for (i = 0; i < noObjects; ++i) { engiGetAggrElement(objects, i, sdaiINSTANCE, &object); // // The loaded schema in openSPFFFile is needed to interpret 'GlobalId' in this function // sdaiGetAttrBN(object, "GlobalId", sdaiSTRING, &string); addObject(parent, object, string); } } }
void searchDeeper(int model, int geometryInstance, STRUCT__OBJECT__COLOR ** ppObjectColor, STRUCT__ITEM__COLOR * itemColor) { int styledItemInstance = 0; #ifdef _UNICODE sdaiGetAttrBN(geometryInstance, (char *) L"StyledByItem", sdaiINSTANCE, &styledItemInstance); #else sdaiGetAttrBN(geometryInstance, "StyledByItem", sdaiINSTANCE, &styledItemInstance); #endif if (styledItemInstance != 0) { getRGB_styledItem(model, styledItemInstance, itemColor); if (itemColor->surface.R >= 0) { return; } } #ifdef _UNICODE int booleanClippingResultEntity = sdaiGetEntity(model, (char *) L"IFCBOOLEANCLIPPINGRESULT"), booleanResultEntity = sdaiGetEntity(model, (char *) L"IFCBOOLEANRESULT"), mappedItemEntity = sdaiGetEntity(model, (char *) L"IFCMAPPEDITEM"), shellBasedSurfaceModelEntity = sdaiGetEntity(model, (char *) L"IFCSHELLBASEDSURFACEMODEL"); #else int booleanClippingResultEntity = sdaiGetEntity(model, "IFCBOOLEANCLIPPINGRESULT"), booleanResultEntity = sdaiGetEntity(model, "IFCBOOLEANRESULT"), mappedItemEntity = sdaiGetEntity(model, "IFCMAPPEDITEM"), shellBasedSurfaceModelEntity = sdaiGetEntity(model, "IFCSHELLBASEDSURFACEMODEL"); #endif if (sdaiGetInstanceType(geometryInstance) == booleanResultEntity || sdaiGetInstanceType(geometryInstance) == booleanClippingResultEntity) { int geometryChildInstance = 0; #ifdef _UNICODE sdaiGetAttrBN(geometryInstance, (char *) L"FirstOperand", sdaiINSTANCE, &geometryChildInstance); #else sdaiGetAttrBN(geometryInstance, "FirstOperand", sdaiINSTANCE, &geometryChildInstance); #endif if (geometryChildInstance) { searchDeeper(model, geometryChildInstance, ppObjectColor, itemColor); } } else if (sdaiGetInstanceType(geometryInstance) == mappedItemEntity) { int representationMapInstance = 0; #ifdef _UNICODE sdaiGetAttrBN(geometryInstance, (char *) L"MappingSource", sdaiINSTANCE, &representationMapInstance); #else sdaiGetAttrBN(geometryInstance, "MappingSource", sdaiINSTANCE, &representationMapInstance); #endif int shapeRepresentationInstance = 0; #ifdef _UNICODE sdaiGetAttrBN(representationMapInstance, (char *) L"MappedRepresentation", sdaiINSTANCE, &shapeRepresentationInstance); #else sdaiGetAttrBN(representationMapInstance, "MappedRepresentation", sdaiINSTANCE, &shapeRepresentationInstance); #endif if (shapeRepresentationInstance) { //ASSERT((*ppObjectColor)->child == 0); if ((*ppObjectColor)->child != 0) return; getRGB_shapeRepresentation(model, shapeRepresentationInstance, &(*ppObjectColor)->child); } } else if (sdaiGetInstanceType(geometryInstance) == shellBasedSurfaceModelEntity) { int * geometryChildAggr = 0; #ifdef _UNICODE sdaiGetAttrBN(geometryInstance, (char *) L"SbsmBoundary", sdaiAGGR, &geometryChildAggr); #else sdaiGetAttrBN(geometryInstance, "SbsmBoundary", sdaiAGGR, &geometryChildAggr); #endif STRUCT__OBJECT__COLOR ** ppSubObjectColor = &(*ppObjectColor)->child; int cnt = sdaiGetMemberCount(geometryChildAggr), i = 0; while (i < cnt) { int geometryChildInstance = 0; engiGetAggrElement(geometryChildAggr, i, sdaiINSTANCE, &geometryChildInstance); if (geometryChildInstance) { //ASSERT((*ppSubObjectColor) == 0); if ((*ppSubObjectColor) != 0) return; (*ppSubObjectColor) = newObjectColor(geometryChildInstance); searchDeeper(model, geometryChildInstance, ppSubObjectColor, (*ppSubObjectColor)->itemColor); ppSubObjectColor = &(*ppSubObjectColor)->next; } i++; } } }
void getRGB_surfaceStyle(int model, int surfaceStyleInstance, STRUCT__ITEM__COLOR * itemColor) { int * styles_set = 0, styles_cnt, i = 0; #ifdef _UNICODE sdaiGetAttrBN(surfaceStyleInstance, (char *) L"Styles", sdaiAGGR, &styles_set); #else sdaiGetAttrBN(surfaceStyleInstance, "Styles", sdaiAGGR, &styles_set); #endif styles_cnt = sdaiGetMemberCount(styles_set); while (i < styles_cnt) { int surfaceStyleRenderingInstance = 0, SurfaceColourInstance = 0, SpecularColourInstance = 0, DiffuseColourInstance = 0; engiGetAggrElement(styles_set, i, sdaiINSTANCE, &surfaceStyleRenderingInstance); #ifdef _UNICODE int surfaceStyleRenderingEntity = sdaiGetEntity(model, (char *) L"IFCSURFACESTYLERENDERING"); #else int surfaceStyleRenderingEntity = sdaiGetEntity(model, "IFCSURFACESTYLERENDERING"); #endif //ASSERT(sdaiGetInstanceType(surfaceStyleRenderingInstance) == surfaceStyleRenderingEntity); if (sdaiGetInstanceType(surfaceStyleRenderingInstance) != surfaceStyleRenderingEntity) return; itemColor->transparency = 0; #ifdef _UNICODE sdaiGetAttrBN(surfaceStyleRenderingInstance, (char *) L"Transparency", sdaiREAL, &itemColor->transparency); #else sdaiGetAttrBN(surfaceStyleRenderingInstance, "Transparency", sdaiREAL, &itemColor->transparency); #endif itemColor->transparency = 1 - itemColor->transparency; #ifdef _UNICODE sdaiGetAttrBN(surfaceStyleRenderingInstance, (char *) L"SurfaceColour", sdaiINSTANCE, &SurfaceColourInstance); #else sdaiGetAttrBN(surfaceStyleRenderingInstance, "SurfaceColour", sdaiINSTANCE, &SurfaceColourInstance); #endif if (SurfaceColourInstance != 0) { getRGB_colourRGB(SurfaceColourInstance, &itemColor->surface); } else { //ASSERT(false); return; } #ifdef _UNICODE sdaiGetAttrBN(surfaceStyleRenderingInstance, (char *) L"DiffuseColour", sdaiINSTANCE, &DiffuseColourInstance); #else sdaiGetAttrBN(surfaceStyleRenderingInstance, "DiffuseColour", sdaiINSTANCE, &DiffuseColourInstance); #endif if (DiffuseColourInstance != 0) { getRGB_colourRGB(DiffuseColourInstance, &itemColor->diffuse); } else { int ADB = 0; #ifdef _UNICODE sdaiGetAttrBN(surfaceStyleRenderingInstance, (char *) L"DiffuseColour", sdaiADB, &ADB); #else sdaiGetAttrBN(surfaceStyleRenderingInstance, "DiffuseColour", sdaiADB, &ADB); #endif if (ADB) { double value = 0; sdaiGetADBValue((void *) ADB, sdaiREAL, &value); itemColor->diffuse.R = value * itemColor->surface.R; itemColor->diffuse.G = value * itemColor->surface.G; itemColor->diffuse.B = value * itemColor->surface.B; } } #ifdef _UNICODE sdaiGetAttrBN(surfaceStyleRenderingInstance, (char *) L"SpecularColour", sdaiINSTANCE, &SpecularColourInstance); #else sdaiGetAttrBN(surfaceStyleRenderingInstance, "SpecularColour", sdaiINSTANCE, &SpecularColourInstance); #endif if (SpecularColourInstance != 0) { getRGB_colourRGB(SpecularColourInstance, &itemColor->specular); } else { int ADB = 0; #ifdef _UNICODE sdaiGetAttrBN(surfaceStyleRenderingInstance, (char *) L"SpecularColour", sdaiADB, &ADB); #else sdaiGetAttrBN(surfaceStyleRenderingInstance, "SpecularColour", sdaiADB, &ADB); #endif if (ADB) { double value = 0; sdaiGetADBValue((void *) ADB, sdaiREAL, &value); itemColor->specular.R = value * itemColor->surface.R; itemColor->specular.G = value * itemColor->surface.G; itemColor->specular.B = value * itemColor->surface.B; } } i++; } }