当前位置: 首页>>代码示例>>C++>>正文


C++ CoordinateSystem类代码示例

本文整理汇总了C++中CoordinateSystem的典型用法代码示例。如果您正苦于以下问题:C++ CoordinateSystem类的具体用法?C++ CoordinateSystem怎么用?C++ CoordinateSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CoordinateSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: m

ElementCoordinatesMappingLocal::ElementCoordinatesMappingLocal(
    const Element& e,
    const CoordinateSystem &global_coords)
: _coords(global_coords), _matR2global(3,3)
{
    assert(e.getDimension() <= global_coords.getDimension());
    _points.reserve(e.getNNodes());
    for(unsigned i = 0; i < e.getNNodes(); i++)
        _points.emplace_back(e.getNode(i)->getCoords());

    auto const element_dimension = e.getDimension();
    auto const global_dimension = global_coords.getDimension();

    if (global_dimension == element_dimension)
    {
        _matR2global.setIdentity();
        return;
    }

    detail::getRotationMatrixToGlobal(element_dimension, global_dimension, _points, _matR2global);
#ifdef OGS_USE_EIGEN
    detail::rotateToLocal(_matR2global.transpose(), _points);
#else
    RotationMatrix* m(_matR2global.transpose());
    detail::rotateToLocal(*m, _points);
    delete m;
#endif
}
开发者ID:mohseniaref,项目名称:ogs,代码行数:28,代码来源:ElementCoordinatesMappingLocal.cpp

示例2: if

//------------------------------------------------------------------------------
// void BuildValidCoordinateSystemList()
//------------------------------------------------------------------------------
void ShowSummaryDialog::BuildValidCoordinateSystemList()
{
   CoordinateSystem *tmpCS = NULL;
   SpacePoint       *origin = NULL;
   std::string      currentCS = coordSysComboBox->GetValue().c_str();
   std::string      newCS     = currentCS;
   Integer          sz;

   // The only valid coordinate system for use here:
   // 1) have a celestial body origin, and
   // 2) do not have a spacecraft as the origin or the primary or the secondary

   // get the names of the coordinate systems
   StringArray coordSystemNames;
   wxArrayString csNames = coordSysComboBox->GetStrings();
   for (Integer ii = 0; ii < (Integer) csNames.GetCount(); ii++)
      coordSystemNames.push_back((csNames.Item(ii)).c_str());
   sz = (Integer) coordSystemNames.size();

   coordSysComboBox->Clear();
   for (Integer ii = 0; ii < sz; ii++)
   {
      if (ii == 0)                                   newCS = coordSystemNames.at(ii);
      else if (currentCS == coordSystemNames.at(ii)) newCS = currentCS;
      tmpCS      = (CoordinateSystem*) theGuiInterpreter->GetConfiguredObject(coordSystemNames.at(ii));
      origin     = tmpCS->GetOrigin();
      if (origin->IsOfType("CelestialBody") && (!tmpCS->UsesSpacecraft()))  // add it to the list
         coordSysComboBox->Append(wxString(coordSystemNames[ii].c_str()));
   }
   coordSysComboBox->SetValue(newCS.c_str());
   currentCoordSysName = coordSysComboBox->GetValue().c_str();
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例3: lock

SPFeatureI FeatureCoverage::newFeature(geos::geom::Geometry *geom, bool load) {

    if ( load) {
        Locker<std::mutex> lock(_loadmutex);
        if (!connector()->dataIsLoaded()) {
            connector()->loadData(this);
        }
    }

    Locker<> lock(_mutex);

    IlwisTypes tp = geometryType(geom);
    auto *newfeature =  createNewFeature(tp);
    if (newfeature ){
        if ( geom) {
            CoordinateSystem *csy = GeometryHelper::getCoordinateSystem(geom);
            if ( csy && !csy->isEqual(coordinateSystem().ptr())){
                CsyTransform trans(csy, coordinateSystem());
                geom->apply_rw(&trans);
            }
            GeometryHelper::setCoordinateSystem(geom, coordinateSystem().ptr());
            newfeature->geometry(geom);
        }else
            setFeatureCount(itUNKNOWN,1,0);

        _features.push_back(newfeature);
        return _features.back();
    }
    return SPFeatureI();

}
开发者ID:CarstenHollmann,项目名称:IlwisCore,代码行数:31,代码来源:featurecoverage.cpp

示例4: spaceSelected

void FrameMetricWrapper::spaceSelected()
{
	if (mInternalUpdate)
		return;
	CoordinateSystem space = mSpaceSelector->getValue();
	if (space.isValid())
		mData->setSpace(space);
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:8,代码来源:cxFrameMetricWrapper.cpp

示例5: while

//------------------------------------------------------------------------------
void Publisher::SetDataMJ2000EqOrigin(CelestialBody *cb)
{
   if (cb == NULL)
      return;
   
   #if DBGLVL_PUBLISHER_DATA_REP
   MessageInterface::ShowMessage
      ("Publisher::SetDataMJ2000EqOrigin() cb=%s<%p>\n", cb->GetName().c_str(),
       cb);
   #endif
   
   dataMJ2000EqOrigin = cb;
   std::string originName = cb->GetName();
   std::string csName = originName + "MJ2000Eq";
      
   std::map<std::string, CoordinateSystem*>::iterator csIter =
      coordSysMap.find(csName);
   
   if (coordSysMap.find(csName) != coordSysMap.end())
   {
      // set coordinate system from the map
      dataCoordSystem = coordSysMap.find(csName)->second;
   }
   else
   {
      // check as local name
      csName = "Local-" + csName;
      if (coordSysMap.find(csName) != coordSysMap.end())
         dataCoordSystem = coordSysMap.find(csName)->second;
      else
      {
         // Create coordinate system if not exist
         CoordinateSystem *newCs = (CoordinateSystem*)internalCoordSystem->Clone();
         newCs->SetName(csName);
         newCs->SetStringParameter("Origin", originName);
         newCs->SetRefObject(cb, Gmat::CELESTIAL_BODY, originName);
         newCs->Initialize();
         coordSysMap[csName] = newCs;
         dataCoordSystem = newCs;
         
         #if DBGLVL_PUBLISHER_DATA_REP
         MessageInterface::ShowMessage
            ("   ===> %s not found in the map, so created <%p>\n", csName.c_str(),
             newCs);
         #endif
      }
   }
   
   // set to subscribers
   std::list<Subscriber*>::iterator current = subscriberList.begin();
   while (current != subscriberList.end())
   {
      (*current)->SetDataMJ2000EqOrigin(cb);
      (*current)->SetDataCoordSystem(dataCoordSystem);
      current++;
   }
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:58,代码来源:Publisher.cpp

示例6: getEllipsoid

bool CoordinateSystemConnector::loadMetaData(IlwisObject* data, const IOOptions& options)
{
    Ilwis3Connector::loadMetaData(data, options);
    CoordinateSystem *csy = static_cast<CoordinateSystem *>(data);
    QString ellipsoideName;

    IEllipsoid ell = getEllipsoid();
    GeodeticDatum *datum = getDatum(ellipsoideName);
    if ( !ell.isValid() && ellipsoideName != sUNDEF){
        QString ellres = QString("ilwis://tables/ellipsoid?code=%1").arg(ellipsoideName);
       if (!ell.prepare(ellres)) {
              return ERROR1("No ellipsoid for this code %1",ellipsoideName);
       }
    }

    QString cb = _odf->value("CoordSystem", "CoordBounds");
    QStringList cbparts = cb.split(" ");
    if ( cbparts.size() == 4 && cbparts[0] != "-1e+308") {
        bool ok1, ok2, ok3, ok4;
        Envelope box( Coordinate(
                                cbparts[0].toDouble(&ok1),
                                cbparts[1].toDouble(&ok2)),
                           Coordinate(
                                cbparts[2].toDouble(&ok3),
                                cbparts[3].toDouble(&ok4)));
        if ( !( ok1 && ok2 && ok3 && ok4)) {
            return ERROR2(ERR_NO_INITIALIZED_2, TR("envelop"), csy->name());
        }
        csy->envelope(box);
    } else {
        QString type = _odf->value("CoordSystem", "Type");
        if ( type == "LatLon") {
            Envelope box(Coordinate(-180,-90), Coordinate(180,90));
            csy->envelope(box);
        }
    }

    if ( type() == itCONVENTIONALCOORDSYSTEM ) {
        ConventionalCoordinateSystem *csycc = static_cast<ConventionalCoordinateSystem *>(csy);
        IProjection proj = getProjection(csycc);
        if ( !proj.isValid()) {
            return ERROR1(ERR_NO_INITIALIZED_1, "projection");
        }
        csycc->setDatum(datum);
        csycc->setEllipsoid(ell);
        csycc->setProjection(proj);
        proj->setCoordinateSystem(csycc);


        proj->setParameter(Projection::pvELLCODE, ell->toProj4());
        csycc->prepare();
    } else if ( type() == itUNKNOWN){
        //TODO: other types of csy
    }
    return true;
}
开发者ID:CarstenHollmann,项目名称:IlwisConnectors,代码行数:56,代码来源:coordinatesystemconnector.cpp

示例7: setupCamera

void Ship :: setupCamera () const
{
	CoordinateSystem camera = getCameraCoordinateSystem();
	const Vector3& camera_position = camera.getPosition();
	const Vector3& camera_up       = camera.getUp();

	Vector3 look_at = camera_position + camera.getForward();

	gluLookAt(camera_position.x, camera_position.y, camera_position.z,
	          look_at.x,         look_at.y,         look_at.z,
	          camera_up.x,       camera_up.y,       camera_up.z);
}
开发者ID:streibeb,项目名称:cs409,代码行数:12,代码来源:Ship.cpp

示例8: extrudePoint

static void extrudePoint(double X[3],const double Z[3])
{
	if (Z[0]==0 && Z[1]==0 && Z[2]>=0) return; /*The coordinate system is WCS*/

	CoordinateSystem<double> XYZ;
	createObjectCoordSystem(&XYZ,Z);

	double nX[3];
	XYZ.fromLocalToGlobal(nX,X);

	vec_copy(X,nX);
}
开发者ID:Gneogeo,项目名称:Parking,代码行数:12,代码来源:dxf_reader.cpp

示例9: main

int main(){
  int xsize, ysize;
  unsigned char * imgbuf;
  double inFluxScale;
#ifdef _WIN32
  if (!loadBitmap("G:\\sources2\\__BR\\RC\\crocodile\\reprojection-pseudocode\\lovell.bmp", &xsize, &ysize, &imgbuf, &inFluxScale)){
#else
  if (!loadBitmap("/home/awson/data/Work/crocodile/reprojection-pseudocode/lovell.bmp", &xsize, &ysize, &imgbuf, &inFluxScale)){
#endif
    printf("Can't load the input!");
    return -1;
  }
  CoordinateSystem inCS = {
  	{0, 0}
  , {500, 500}
  , { {-0.000027778, 0}
  	, { 0, 0.000027778}
    }
  };
  inCS.prepare();
  CoordinateSystem outCS = {
  	{0, 0}
  , {500, 500}
  , { {-0.00002, -0.00002}
  	, {-0.00002,  0.00002}
    }
  };
  outCS.prepare();

  vector<double> inp(xsize * ysize);
  vector<double> outp(xsize * ysize);

  unsigned char * it = imgbuf;
  for (double & v : inp) v = double(*it++);

  printf("Start repro ...\n");
  reprojection(
      inCS
    , outCS
    , {xsize, ysize}
    , {xsize, ysize}
    , inp.data()
    , outp.data()
  );
  printf("Done repro!\n");

  // Dirty! Reuse imgbuf.
  it = imgbuf;
  for (double v : outp) *it++ = (unsigned char)(min(255.0, v));

  saveBitmap("image.bmp", xsize, ysize, imgbuf, inFluxScale * pixelAreaRatio(inCS, outCS));
  free(imgbuf);
}
开发者ID:SKA-ScienceDataProcessor,项目名称:RC,代码行数:53,代码来源:reprojection.cpp

示例10: playerFireBullet

void World::playerFireBullet()
{
	if (m_playerShip.isAlive() && m_playerShip.isBulletReady())
	{
		CoordinateSystem cs = m_playerShip.getCoordinate();
		m_bullets[m_nextBulletIndex].fire(cs.getPosition(), cs.getForward(), m_playerShip.getId());
		m_playerShip.reloadBullet();
		m_nextBulletIndex++;
		if (m_nextBulletIndex == Const::BULLET_COUNT){
			m_nextBulletIndex = 0;
		}
	}
}
开发者ID:whitelight2134,项目名称:spacewar,代码行数:13,代码来源:World.cpp

示例11: SIGNAL

AxisConnector::AxisConnector(CoordinateSystem space, SpaceProviderPtr spaceProvider)
{
	mSpaceProvider = spaceProvider;
	mListener = mSpaceProvider->createListener();
	mListener->setSpace(space);
	connect(mListener.get(), SIGNAL(changed()), this, SLOT(changedSlot()));

	mRep = AxesRep::New(space.toString() + "_axis");
	mRep->setCaption(space.toString(), Vector3D(1, 0, 0));
	mRep->setShowAxesLabels(false);
	mRep->setFontSize(0.08);
	mRep->setAxisLength(0.03);
	this->changedSlot();
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:14,代码来源:cxAxisConnector.cpp

示例12: addBodyPointers

//---------------------------------------------------------------------------
Body::Body(const CoordinateSystem<3> xyz, shared_ptr<SurfaceModel>  shell)
    : coordinate_(xyz), toptol_(shell->getTolerances())
//---------------------------------------------------------------------------
{
    shells_.push_back(shell);
    addBodyPointers();
}
开发者ID:99731,项目名称:GoTools,代码行数:8,代码来源:Body.C

示例13: createPathNodes

		string Ellipse::createPathNodes(Point point, CoordinateSystem& drawing, bool alwaysShowFirstPoint) {
			string path("");
			Point startPoint = drawing.map(getFirstPoint());
			path += "M " + NumberUtil::formatFloat(startPoint.getX()) + "," 
						+ NumberUtil::formatFloat(startPoint.getY());
		
			for (int i = 1; i <= 4; i++) {
				Point nextPoint = drawing.map(EllipticalArc::point((float) (M_PI * i / 2.0),  m_radius, m_centre,m_eccentricity));
				path += " A " + NumberUtil::formatFloat(m_radius) + "," 
						+ NumberUtil::formatFloat(m_radius * m_eccentricity)
						+ NumberUtil::formatFloat(m_inclination) + " 0,0 "
						+ NumberUtil::formatFloat(nextPoint.getX()) + ","
						+ NumberUtil::formatFloat(nextPoint.getY());
			}
		
			path += " Z ";
			return path;
		}
开发者ID:bcholmes,项目名称:fcw2svg,代码行数:18,代码来源:Ellipse.cpp

示例14: TransformOp

void SOP_SceneCacheSource::transformObject( IECore::Object *object, const Imath::M44d &transform, bool &hasAnimatedTopology, bool &hasAnimatedPrimVars, std::vector<InternedString> &animatedPrimVars )
{
	Primitive *primitive = IECore::runTimeCast<Primitive>( object );
	if ( primitive )
	{
		TransformOpPtr transformer = new TransformOp();
		transformer->inputParameter()->setValue( primitive );
		transformer->copyParameter()->setTypedValue( false );
		transformer->matrixParameter()->setValue( new M44dData( transform ) );
		transformer->operate();
		
		std::vector<std::string> &primVars = transformer->primVarsParameter()->getTypedValue();
		for ( std::vector<std::string>::iterator it = primVars.begin(); it != primVars.end(); ++it )
		{
			if ( std::find( animatedPrimVars.begin(), animatedPrimVars.end(), *it ) == animatedPrimVars.end() )
			{
				animatedPrimVars.push_back( *it );
				hasAnimatedPrimVars = true;
			}
		}
		
		return;
	}
	
	Group *group = IECore::runTimeCast<Group>( object );
	if ( group )
	{
		MatrixTransformPtr matTransform = matrixTransform( transform );
		matTransform->matrix *= group->getTransform()->transform();
		group->setTransform( matTransform );
		return;
	}
	
	CoordinateSystem *coord = IECore::runTimeCast<CoordinateSystem>( object );
	if ( coord )
	{
		MatrixTransformPtr matTransform = matrixTransform( transform );
		matTransform->matrix *= coord->getTransform()->transform();
		coord->setTransform( matTransform );
		return;
	}
}
开发者ID:richardmonette,项目名称:cortex,代码行数:42,代码来源:SOP_SceneCacheSource.cpp

示例15: if

IlwisObject *InternalIlwisObjectFactory::createCsyFromCode(const Resource& resource, const IOOptions &options) const {
    QString code = resource.code();
    bool isUnknown = code == "unknown" || code == "csy:unknown";
    QString projParms = code;
    if ( code.left(6) == "proj4:"){
        projParms = code.mid(6);
    }else if(!isUnknown && code.left(5) == "epsg:"){
        QString query = QString("select * from projectedcsy where code='%1'").arg(code);
        InternalDatabaseConnection db;
        if ( db.exec(query)) {
            if (db.next()) {
                QSqlRecord rec = db.record();
                projParms = rec.value("proj_params").toString();
            } else {
                kernel()->issues()->log(TR(ERR_COULDNT_CREATE_OBJECT_FOR_2).arg("coordinatesystem", resource.name()));
                return 0;
            }
        }
    }
    CoordinateSystem *csy = 0;
    if ( isUnknown){
        csy = createFromResource<BoundsOnlyCoordinateSystem>(resource, options);
        csy->name("unknown");
        csy->code("unknown");
        csy->setDescription(TR("Unknown coordinate system"));
    }else {
        csy = createFromResource<ConventionalCoordinateSystem>(resource, options);
        csy->setDescription(resource.name());
        csy->prepare("proj4=" + projParms);
    }

    return csy;

}
开发者ID:MartinSchouwenburg,项目名称:IlwisTest,代码行数:34,代码来源:internalilwisobjectfactory.cpp


注:本文中的CoordinateSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。