Exemplo n.º 1
0
SDAI_Application_instance *
STEPWrapper::getEntity(int STEPid, const char *name)
{
    SDAI_Application_instance *se = getEntity(STEPid);

    if (se->IsComplex()) {
	se = getSuperType(STEPid, name);
    }
    return se;
}
Exemplo n.º 2
0
void
STEPWrapper::getSuperTypes(int STEPid, MAP_OF_SUPERTYPES &m)
{
    SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity();

    if (sse->IsComplex()) {
	STEPcomplex *sc = ((STEPcomplex *)sse)->head;
	while (sc) {
	    m[sc->EntityName()] = sc;
	    sc = sc->sc;
	}
    }
}
Exemplo n.º 3
0
MAP_OF_SUPERTYPES *
STEPWrapper::getMapOfSuperTypes(int STEPid)
{
    MAP_OF_SUPERTYPES *m = new MAP_OF_SUPERTYPES;
    SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity();

    if (sse->IsComplex()) {
	STEPcomplex *sc = ((STEPcomplex *)sse)->head;
	while (sc) {
	    (*m)[sc->EntityName()] = sc;
	    sc = sc->sc;
	}
    }

    return m;
}
Exemplo n.º 4
0
SDAI_Application_instance *
STEPWrapper::getSuperType(int STEPid, const char *name)
{
    SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity();
    std::string attrval;

    if (sse->IsComplex()) {
	STEPcomplex *sc = ((STEPcomplex *)sse)->head;
	while (sc) {
	    std::string ename = sc->EntityName();

	    if (ename.compare(name) == 0) {
		return sc;
	    }
	    sc = sc->sc;
	}
    }
    return NULL;
}
Exemplo n.º 5
0
bool Representation::Load(STEPWrapper *sw, SDAI_Application_instance *sse)
{
    step = sw;
    id = sse->STEPfile_id;

    // need to do this for local attributes to makes sure we have
    // the actual entity and not a complex/supertype parent
    sse = step->getEntity(sse, ENTITYNAME);

    name = step->getStringAttribute(sse, "name");

    if (items.empty()) {
	LIST_OF_ENTITIES *l = step->getListOfEntities(sse, "items");
	LIST_OF_ENTITIES::iterator i;
	for (i = l->begin(); i != l->end(); i++) {
	    SDAI_Application_instance *entity = (*i);
	    if (entity) {
		RepresentationItem *aRI = dynamic_cast<RepresentationItem *>(Factory::CreateObject(sw, entity));
		if (aRI != NULL)
		    items.push_back(aRI);
	    } else {
		std::cerr << CLASSNAME << ": Unhandled entity in attribute 'items'." << std::endl;
		l->clear();
		delete l;
		return false;
	    }
	}
	l->clear();
	delete l;
    }

    if (context_of_items.empty()) {
	SDAI_Application_instance *entity = step->getEntityAttribute(sse, "context_of_items");
	if (entity) {
	    if (entity->IsComplex()) {
		SDAI_Application_instance *sub_entity = step->getEntity(entity, "Geometric_Representation_Context");
		if (sub_entity) {
		    GeometricRepresentationContext *aGRC = new GeometricRepresentationContext();

		    context_of_items.push_back(aGRC);
		    if (!aGRC->Load(step, sub_entity)) {
			std::cout << CLASSNAME << ":Error loading GeometricRepresentationContext" << std::endl;
			return false;
		    }
		}

		sub_entity = step->getEntity(entity, "Global_Uncertainty_Assigned_Context");
		if (sub_entity) {
		    GlobalUncertaintyAssignedContext *aGUAC = new GlobalUncertaintyAssignedContext();

		    context_of_items.push_back(aGUAC);
		    if (!aGUAC->Load(step, sub_entity)) {
			std::cout << CLASSNAME << ":Error loading GlobalUncertaintyAssignedContext" << std::endl;
			return false;
		    }
		}

		sub_entity = step->getEntity(entity, "Global_Unit_Assigned_Context");
		if (sub_entity) {
		    GlobalUnitAssignedContext *aGUAC = new GlobalUnitAssignedContext();

		    context_of_items.push_back(aGUAC);
		    if (!aGUAC->Load(step, sub_entity)) {
			std::cout << CLASSNAME << ":Error loading GlobalUnitAssignedContext" << std::endl;
			return false;
		    }
		}

		sub_entity = step->getEntity(entity, "Parametric_Representation_Context");
		if (sub_entity) {
		    ParametricRepresentationContext *aPRC = new ParametricRepresentationContext();

		    context_of_items.push_back(aPRC);
		    if (!aPRC->Load(step, sub_entity)) {
			std::cout << CLASSNAME << ":Error loading ParametricRepresentationContext" << std::endl;
			return false;
		    }
		}
	    } else {
		RepresentationContext *aRC = dynamic_cast<RepresentationContext *>(Factory::CreateObject(sw, entity));
		if (aRC != NULL) {
		    context_of_items.push_back(aRC);
		} else {
		    std::cout << CLASSNAME << ":Error loading RepresentationContext" << std::endl;
		    return false;
		}
	    }
	} else {
	    std::cout << CLASSNAME << ":Error loading \"context_of_items\"" << std::endl;
	    return false;
	}
    }
    return true;
}