Exemplo n.º 1
0
CCPACSControlSurfaceDevice::CCPACSControlSurfaceDevice(CCPACSConfiguration* config, CCPACSWingComponentSegment* segment)
    : outerShape(this, segment)
    , _segment(segment)
    , _config(config)
{
    SetUID("ControlDevice");
    _hingeLine = CSharedPtr<CTiglControlSurfaceHingeLine>(new CTiglControlSurfaceHingeLine(&outerShape, &path,_segment));
}
void CTiglAbstractGeometricComponent::Reset()
{
    SetUID("");
    mySymmetryAxis = TIGL_NO_SYMMETRY;
    transformation.SetIdentity();
    backTransformation.SetIdentity();
    translation = CTiglPoint(0.,0.,0.);
    scaling     = CTiglPoint(1.,1.,1.);
    rotation    = CTiglPoint(0.,0.,0.);
    translationType = ABS_LOCAL;
}
Exemplo n.º 3
0
// Read CPACS fuselage element
void CCPACSFuselage::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& fuselageXPath)
{
    Cleanup();

    char*       elementPath;
    std::string tempString;

    // Get subelement "name"
    char* ptrName = NULL;
    tempString    = fuselageXPath + "/name";
    elementPath   = const_cast<char*>(tempString.c_str());
    if (tixiGetTextElement(tixiHandle, elementPath, &ptrName)==SUCCESS) {
        name = ptrName;
    }

    // Get attribue "uID"
    char* ptrUID = NULL;
    tempString   = "uID";
    elementPath  = const_cast<char*>(tempString.c_str());
    if (tixiGetTextAttribute(tixiHandle, const_cast<char*>(fuselageXPath.c_str()), const_cast<char*>(tempString.c_str()), &ptrUID) == SUCCESS) {
        SetUID(ptrUID);
    }

    // Get subelement "parent_uid"
    char* ptrParentUID = NULL;
    tempString         = fuselageXPath + "/parentUID";
    elementPath        = const_cast<char*>(tempString.c_str());
    if (tixiCheckElement(tixiHandle, elementPath) == SUCCESS  && 
        tixiGetTextElement(tixiHandle, elementPath, &ptrParentUID) == SUCCESS ) {

        SetParentUID(ptrParentUID);
    }

    transformation.ReadCPACS(tixiHandle, fuselageXPath);

    // Get subelement "sections"
    sections.ReadCPACS(tixiHandle, fuselageXPath);

    // Get subelement "positionings"
    positionings.ReadCPACS(tixiHandle, fuselageXPath);

    // Get subelement "segments"
    segments.ReadCPACS(tixiHandle, fuselageXPath);

    // Register ourself at the unique id manager
    configuration->GetUIDManager().AddUID(ptrUID, this);

    // Get symmetry axis attribute
    char* ptrSym = NULL;
    tempString   = "symmetry";
    if (tixiGetTextAttribute(tixiHandle, const_cast<char*>(fuselageXPath.c_str()), const_cast<char*>(tempString.c_str()), &ptrSym) == SUCCESS) {
        SetSymmetryAxis(ptrSym);
    }
}
Exemplo n.º 4
0
// Read CPACS trailingEdgeDevice elements
void CCPACSControlSurfaceDevice::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& controlSurfaceDeviceXPath, TiglControlSurfaceType type)
{
    char*       elementPath;
    std::string tempString;

    // Get sublement "outerShape"
    char* ptrName = NULL;
    tempString    = controlSurfaceDeviceXPath + "/outerShape";
    elementPath   = const_cast<char*>(tempString.c_str());
    if (tixiGetTextElement(tixiHandle, elementPath, &ptrName) == SUCCESS) {
        outerShape.ReadCPACS(tixiHandle, elementPath, type);
    }

    // Get Path
    tempString = controlSurfaceDeviceXPath + "/path";
    elementPath = const_cast<char*>(tempString.c_str());
    if (tixiCheckElement(tixiHandle, elementPath) == SUCCESS) {
        path.ReadCPACS(tixiHandle, elementPath);
    }


    char* ptrUID = NULL;
    if (tixiGetTextAttribute(tixiHandle, controlSurfaceDeviceXPath.c_str(), "uID", &ptrUID) == SUCCESS) {
        SetUID(ptrUID);
    }

    // Get WingCutOut
    tempString = controlSurfaceDeviceXPath + "/wingCutOut";
    elementPath = const_cast<char*>(tempString.c_str());
    if (tixiCheckElement(tixiHandle, elementPath) == SUCCESS) {
        wingCutOut = CSharedPtr<CCPACSControlSurfaceDeviceWingCutOut>(new CCPACSControlSurfaceDeviceWingCutOut(*this, *_segment));
        wingCutOut->ReadCPACS(tixiHandle, elementPath);
    }

    _type = type;

    currentDeflection = GetMinDeflection() > 0? GetMinDeflection() : 0;
    currentDeflection = currentDeflection > GetMaxDeflection()? GetMaxDeflection() : currentDeflection;
}
Exemplo n.º 5
0
void Entity::Initialize(World& world, boost::property_tree::ptree* pt, std::string uid) {
	float x = pt->get<float>("entities."+uid+".x");
	float y = pt->get<float>("entities."+uid+".y");
	std::string img = pt->get<std::string>("entities."+uid+".img");
	float rot = pt->get<float>("entities."+uid+".rot");
	float a = pt->get<float>("entities."+uid+".a");
	float s = pt->get<float>("entities."+uid+".s");
	int l = pt->get<int>("entities."+uid+".l");
	int ll = pt->get<int>("entities."+uid+".ll");
	bool phy = pt->get<bool>("entities."+uid+".phy");
	if(uid=="player") {
		rot = 0;
		x = 3;
		y = -2;
	}
	SetScale(s);
	SetLocalLayer(ll);
	SetPosition(Vector2D(x,y));
	SetRotation(rot);
	SetAlpha(a);
	SetUID(uid);
	Initialize(world, img, l, phy);
}