void LineoutAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("LineoutAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("point1")) != 0) SetPoint1(node->AsDoubleArray()); if((node = searchNode->GetNode("point2")) != 0) SetPoint2(node->AsDoubleArray()); if((node = searchNode->GetNode("interactive")) != 0) SetInteractive(node->AsBool()); if((node = searchNode->GetNode("ignoreGlobal")) != 0) SetIgnoreGlobal(node->AsBool()); if((node = searchNode->GetNode("samplingOn")) != 0) SetSamplingOn(node->AsBool()); if((node = searchNode->GetNode("numberOfSamplePoints")) != 0) SetNumberOfSamplePoints(node->AsInt()); if((node = searchNode->GetNode("reflineLabels")) != 0) SetReflineLabels(node->AsBool()); if((node = searchNode->GetNode("designator")) != 0) SetDesignator(node->AsString()); }
void CylinderAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("CylinderAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("point1")) != 0) SetPoint1(node->AsDoubleArray()); if((node = searchNode->GetNode("point2")) != 0) SetPoint2(node->AsDoubleArray()); if((node = searchNode->GetNode("radius")) != 0) SetRadius(node->AsDouble()); }
Pulley::Pulley(int length, int numberOfPartciles, SGD::Vector location) { index = 0; r = new Rope(length, numberOfPartciles, location); SetPoint1({ r->GetParticleAt(10)->GetCurrPosition().x-100.0f, r->GetParticleAt(10)->GetCurrPosition().y -100.0f }); SetPoint2({ r->GetParticleAt(10)->GetCurrPosition().x, r->GetParticleAt(10)->GetCurrPosition().y - 200.0f }); SetPoint3({ r->GetParticleAt(10)->GetCurrPosition().x+50.0f, r->GetParticleAt(10)->GetCurrPosition().y - 180.0f }); r->GetParticleAt(9)->SetFixed(true); r->GetParticleAt(10)->SetFixed(true); r->GetParticleAt(11)->SetFixed(true); r->GetParticleAt(9)->SetCurrPosition(GetPoint1()); r->GetParticleAt(10)->SetCurrPosition(GetPoint2()); r->GetParticleAt(11)->SetCurrPosition(GetPoint3()); r->GetParticleAt(19)->SetMass(800.0f); r->GetParticleAt(0)->SetCurrPosition({ r->GetParticleAt(9)->GetCurrPosition().x-100.0f, r->GetParticleAt(9)->GetCurrPosition().y + 150.0f }); r->GetParticleAt(19)->SetCurrPosition({ r->GetParticleAt(11)->GetCurrPosition().x +150.0f, r->GetParticleAt(11)->GetCurrPosition().y + 150.0f }); }
bool CylinderAttributes::CopyAttributes(const AttributeGroup *atts) { bool retval = false; if(TypeName() == atts->TypeName()) { // Call assignment operator. const CylinderAttributes *tmp = (const CylinderAttributes *)atts; *this = *tmp; retval = true; } else if(atts->TypeName() == "Line") { const Line *tmp = (const Line*)atts; SetPoint1(tmp->GetPoint1()); SetPoint2(tmp->GetPoint2()); retval = true; } return retval; }
// **************************************************************************** // // Modifications: // Kathleen Bonnell, Thu Nov 18 17:46:02 PST 2004 // Copy ReflineLabels. // // Kathleen Bonnell, Tue Nov 23 09:19:32 PST 2004 // Added ability to copy GlobalLineoutAttributes, as long as we aren't // ignoring them. // // Kathleen Bonnell, Tue May 15 14:22:23 PDT 2007 // Allow Line to copy SamplingOn. // // **************************************************************************** bool LineoutAttributes::CopyAttributes(const AttributeGroup *atts) { bool retval = false; if(TypeName() == atts->TypeName()) { // Call assignment operator. const LineoutAttributes *tmp = (const LineoutAttributes *)atts; *this = *tmp; retval = true; } else if(atts->TypeName() == "Line") { const Line *tmp = (const Line*)atts; SetPoint1(tmp->GetPoint1()); SetPoint2(tmp->GetPoint2()); SetDesignator(tmp->GetDesignator()); SetNumberOfSamplePoints(tmp->GetNumSamples()); SetSamplingOn(GetSamplingOn() || tmp->GetSamplingOn()); retval = true; } else if(atts->TypeName() == "GlobalLineoutAttributes") { if (!ignoreGlobal) { const GlobalLineoutAttributes *tmp = (const GlobalLineoutAttributes*)atts; SetReflineLabels(tmp->GetCreateReflineLabels()); SetSamplingOn(tmp->GetSamplingOn()); SetNumberOfSamplePoints(tmp->GetNumSamples()); retval = true; } } return retval; }