bool CSPrimPoint::Update(string *ErrStr) { bool bOK=m_Coords.Evaluate(ErrStr); if (bOK==false) { stringstream stream; stream << endl << "Error in Point (ID: " << uiID << "): "; ErrStr->append(stream.str()); } m_Coords.SetCoordinateSystem(m_PrimCoordSystem, m_MeshType); //update local bounding box GetBoundBox(m_BoundBox); return bOK; }
bool CSPrimRotPoly::Update(string *ErrStr) { int EC=0; bool bOK = CSPrimPolygon::Update(ErrStr); EC=StartStopAngle[0].Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=ParameterScalar::NO_ERROR) && (ErrStr!=NULL)) { bOK=false; stringstream stream; stream << endl << "Error in RotPoly Start Angle (ID: " << uiID << "): "; ErrStr->append(stream.str()); PSErrorCode2Msg(EC,ErrStr); } EC=StartStopAngle[1].Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=ParameterScalar::NO_ERROR) && (ErrStr!=NULL)) { bOK=false; stringstream stream; stream << endl << "Error in RotPoly Stop Angle (ID: " << uiID << "): "; ErrStr->append(stream.str()); PSErrorCode2Msg(EC,ErrStr); } // make angle range to 0..2*M_PI & stop > start! m_StartStopAng[0]=StartStopAngle[0].GetValue(); m_StartStopAng[1]=StartStopAngle[1].GetValue(); if (m_StartStopAng[0]>m_StartStopAng[1]) m_StartStopAng[1]+=2*M_PI; if (m_StartStopAng[0]>2*M_PI) { m_StartStopAng[0]-=2*M_PI; m_StartStopAng[1]-=2*M_PI; } if (m_StartStopAng[0]<0) { m_StartStopAng[0]+=2*M_PI; m_StartStopAng[1]+=2*M_PI; } //update local bounding box GetBoundBox(m_BoundBox); return bOK; }
bool CSPrimSphericalShell::Update(std::string *ErrStr) { int EC=0; bool bOK=CSPrimSphere::Update(ErrStr); EC=psShellWidth.Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=ParameterScalar::NO_ERROR) && (ErrStr!=NULL)) { bOK=false; std::stringstream stream; stream << std::endl << "Error in " << PrimTypeName << " shell-width (ID: " << uiID << "): "; ErrStr->append(stream.str()); PSErrorCode2Msg(EC,ErrStr); } //update local bounding box m_BoundBoxValid = GetBoundBox(m_BoundBox); return bOK; }
bool CSPrimMultiBox::Update(std::string *ErrStr) { int EC=0; bool bOK=true; for (size_t i=0;i<vCoords.size();++i) { EC=vCoords.at(i)->Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=0) && (ErrStr!=NULL)) { bOK=false; std::stringstream stream; stream << std::endl << "Error in MultiBox (ID: " << uiID << "): "; ErrStr->append(stream.str()); PSErrorCode2Msg(EC,ErrStr); } } //update local bounding box m_BoundBoxValid = GetBoundBox(m_BoundBox); return bOK; }
bool CSPrimLinPoly::Update(string *ErrStr) { int EC=0; bool bOK = CSPrimPolygon::Update(ErrStr); EC=extrudeLength.Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=ParameterScalar::NO_ERROR) && (ErrStr!=NULL)) { bOK=false; stringstream stream; stream << endl << "Error in Polygon Elevation (ID: " << uiID << "): "; ErrStr->append(stream.str()); PSErrorCode2Msg(EC,ErrStr); } //update local bounding box GetBoundBox(m_BoundBox); return bOK; }
bool CSPrimPolygon::Update(std::string *ErrStr) { int EC=0; bool bOK=true; if (! ((m_PrimCoordSystem==CARTESIAN) || (m_PrimCoordSystem==UNDEFINED_CS && m_MeshType==CARTESIAN))) { std::cerr << "CSPrimPolygon::Update: Warning: CSPrimPolygon can not be defined in non Cartesian coordinate systems! Result may be unexpected..." << std::endl; ErrStr->append("Warning: CSPrimPolygon can not be defined in non Cartesian coordinate systems! Result may be unexpected...\n"); } for (size_t i=1;i<vCoords.size();++i) { EC=vCoords[i].Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=ParameterScalar::NO_ERROR) && (ErrStr!=NULL)) { bOK=false; std::stringstream stream; stream << std::endl << "Error in Polygon (ID: " << uiID << "): "; ErrStr->append(stream.str()); PSErrorCode2Msg(EC,ErrStr); } } EC=Elevation.Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=ParameterScalar::NO_ERROR) && (ErrStr!=NULL)) { bOK=false; std::stringstream stream; stream << std::endl << "Error in Polygon Elevation (ID: " << uiID << "): "; ErrStr->append(stream.str()); PSErrorCode2Msg(EC,ErrStr); } //update local bounding box used to speedup IsInside() m_BoundBoxValid = GetBoundBox(m_BoundBox); return bOK; }
ZIntCuboid ZDvidDataSliceHelper::getBoundBox() const { return GetBoundBox(getViewPort(), getZ()); }
bool CSPrimUserDefined::Update(std::string *ErrStr) { int EC=0; bool bOK=true; std::string vars; switch (CoordSystem) { case CARESIAN_SYSTEM: vars=std::string("x,y,z"); break; case CYLINDER_SYSTEM: vars=std::string("x,y,z,r,a"); break; case SPHERE_SYSTEM: vars=std::string("x,y,z,r,a,t"); break; default: //unknown System return false; break; } iQtyParameter=clParaSet->GetQtyParameter(); if (iQtyParameter>0) { fParameter=std::string(clParaSet->GetParameterString()); vars = fParameter + "," + vars; } fParse->Parse(stFunction,vars); EC=fParse->GetParseErrorType(); //cout << fParse.ErrorMsg(); if (EC!=FunctionParser::FP_NO_ERROR) bOK=false; if ((EC!=FunctionParser::FP_NO_ERROR) && (ErrStr!=NULL)) { std::ostringstream oss; oss << "\nError in User Defined Primitive Function (ID: " << uiID << "): " << fParse->ErrorMsg(); ErrStr->append(oss.str()); bOK=false; } for (int i=0;i<3;++i) { EC=dPosShift[i].Evaluate(); if (EC!=ParameterScalar::NO_ERROR) bOK=false; if ((EC!=ParameterScalar::NO_ERROR) && (ErrStr!=NULL)) { bOK=false; std::ostringstream oss; oss << "\nError in User Defined Primitive Coord (ID: " << uiID << "): "; ErrStr->append(oss.str()); PSErrorCode2Msg(EC,ErrStr); } } //update local bounding box m_BoundBoxValid = GetBoundBox(m_BoundBox); return bOK; }