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


C++ Projection::SetCoordinate方法代码示例

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


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

示例1: updateLabels

  /**
   * Updates the tracking labels.
   * Displays the Planetocentric Latitude and 360 Positive East
   * Longitude in the lower right corner of the window.
   *
   *
   * @param p
   */
  void MosaicTrackTool::updateLabels(QPointF p) {
    //----------------------------------------------------------------------
    // we need to find out if the point given is over an item, if not, call
    // clearLables() if so, then we need to get the item and figure out the
    // lat/lon that corresponds with the given point.
    //----------------------------------------------------------------------
    Projection *proj = getWidget()->getProjection();
    TProjection *tproj = (TProjection *) proj;

    if (!proj || proj->projectionType() != Projection::Triaxial) {
      clearLabels();
      return;
    }

    proj->SetCoordinate(p.x(), -1 * p.y());

    if(p_lonLabel) {
      p_lonLabel->setVisible(true);
      p_lonLabel->setText("LON " + QString::number(tproj->Longitude()));
    }

    if(p_latLabel) {
      p_latLabel->setVisible(true);
      p_latLabel->setText("LAT " + QString::number(tproj->Latitude()));
    }

    if(p_xLabel) {
      p_xLabel->setVisible(true);
      p_xLabel->setText("X " + QString::number(p.x()));
    }

    if(p_yLabel) {
      p_yLabel->setVisible(true);
      p_yLabel->setText("Y " + QString::number(-1 * p.y()));
    }
  }
开发者ID:jlaura,项目名称:isis3,代码行数:44,代码来源:MosaicTrackTool.cpp

示例2: ExtractLatLonRange

/**
 * Removes control points not in the lat/lon range provided in the unput 
 * parameters. 
 * 
 * @param outNet The output control net being removed from
 * @param noLanLonPoint The keyword recording all of the control points removed
 *                      due to the provided lat/lon range
 * @param noLanLonPoint The keyword recording all of the control points removed
 *                      due to the inability to calculate the lat/lon for that
 *                      point
 */
void ExtractLatLonRange( ControlNet & outNet, PvlKeyword & nonLatLonPoints,
                         PvlKeyword & cannotGenerateLatLonPoints,  map<iString,iString> sn2filename ) {
  if( outNet.Size() == 0 ) { return; }

  UserInterface &ui = Application::GetUserInterface();

  // Get the lat/lon and fix the range for the internal 0/360
  double minlat = ui.GetDouble("MINLAT");
  double maxlat = ui.GetDouble("MAXLAT");
  double minlon = ui.GetDouble("MINLON");
  if( minlon < 0.0 ) { minlon += 360; }
  double maxlon = ui.GetDouble("MAXLON");
  if( maxlon < 0.0 ) { minlon += 360; }

  bool useNetwork = ui.GetBoolean("USENETWORK");

  Progress progress;
  progress.SetText("Calculating lat/lon");
  progress.SetMaximumSteps(outNet.Size());
  progress.CheckStatus();

  CubeManager manager;
  manager.SetNumOpenCubes( 50 ); //Should keep memory usage to around 1GB

  for( int cp = outNet.Size()-1; cp >= 0; cp --) {
    progress.CheckStatus();

    // If the Contorl Network takes priority, use it
    double pointLat = outNet[cp].UniversalLatitude();
    double pointLon = outNet[cp].UniversalLongitude();
    bool useControlNet = useNetwork && pointLat > -1000 && pointLon > -1000;
    if( outNet[cp].Type() == Isis::ControlPoint::Ground || useControlNet ) {
      if( NotInLatLonRange( outNet[cp].UniversalLatitude(),
                            outNet[cp].UniversalLongitude(),
                            minlat, maxlat, minlon, maxlon ) ) {
        nonLatLonPoints += outNet[cp].Id();
        outNet.Delete( cp );
      }
    }

    /** 
     * If the lat/lon cannot be determined from the point, then we need to calculate
     * lat/lon on our own 
     */
    else if( ui.WasEntered("FROMLIST") ) {

      // Find a cube in the Control Point to get the lat/lon from
      int cm = 0;
      iString sn = "";
      double lat = 0.0;
      double lon = 0.0;
      double radius = 0.0;

      // First check the reference Measure
      if( outNet[cp].HasReference() ) {
        cm = outNet[cp].ReferenceIndex();
        if( !sn2filename[outNet[cp][cm].CubeSerialNumber()].empty() ) {
          sn = outNet[cp][cm].CubeSerialNumber();
        }
      }

      // Search for other Control Measures if needed
      if( sn.empty() ) {
        // Find the Serial Number if it exists
        for( int cm = 0; (cm < outNet[cp].Size()) && sn.empty(); cm ++ ) {
          if( !sn2filename[outNet[cp][cm].CubeSerialNumber()].empty() ) {
            sn = outNet[cp][cm].CubeSerialNumber();
          }
        }
      }

      // Connot fine a cube to get the lat/lon from
      if( sn.empty() ) {
        cannotGenerateLatLonPoints += outNet[cp].Id();
        outNet.Delete( cp );
      }

      // Calculate the lat/lon and check for validity
      else {
        bool remove = false;

        Cube *cube = manager.OpenCube( sn2filename[sn] );
        Camera *camera = cube->Camera();

        if (camera == NULL) {
          try {
            Projection *projection = ProjectionFactory::Create( (*(cube->Label())) );

            if(!projection->SetCoordinate(outNet[cp][cm].Sample(),outNet[cp][cm].Line())) {
//.........这里部分代码省略.........
开发者ID:assutech,项目名称:isis3,代码行数:101,代码来源:cnetextract.cpp

示例3: main

int main() {
  Isis::Preference::Preferences(true);
  try {
    cout << "Test 1, create a seeder" << endl;

    PvlGroup alg("PolygonSeederAlgorithm");

    if(!alg.hasKeyword("Name")) {
      cout << "Test without subgrid" << endl;
      alg += PvlKeyword("Name", "Strip");
      alg += PvlKeyword("MinimumThickness", toString(0.3));
      alg += PvlKeyword("MinimumArea", toString(10));
      alg += PvlKeyword("XSpacing", toString(1500));
      alg += PvlKeyword("YSpacing", toString(1500));
    }

    PvlObject o("AutoSeed");
    o.addGroup(alg);

    Pvl pvl;
    pvl.addObject(o);
    cout << pvl << endl << endl;

    PolygonSeeder *ps = PolygonSeederFactory::Create(pvl);

    std::cout << "Test to make sure Parse did it's job" << std::endl;
    std::cout << "MinimumThickness = " << ps->MinimumThickness() << std::endl;
    std::cout << "MinimumArea = " << ps->MinimumArea() << std::endl;

    cout << "Test 2, test a square polygon" << endl;
    try {
      // Call the seed member with a polygon
      geos::geom::CoordinateSequence *pts;
      vector<geos::geom::Geometry *> polys;

      // Create the A polygon
      pts = new geos::geom::CoordinateArraySequence();
      pts->add(geos::geom::Coordinate(0, 0));
      pts->add(geos::geom::Coordinate(0, 1.5));
      pts->add(geos::geom::Coordinate(0.5, 1.5));
      pts->add(geos::geom::Coordinate(0.5, 0));
      pts->add(geos::geom::Coordinate(0, 0));

      polys.push_back(Isis::globalFactory.createPolygon(
                        Isis::globalFactory.createLinearRing(pts), NULL));

      geos::geom::MultiPolygon *mp = Isis::globalFactory.createMultiPolygon(polys);

      cout << "Lon/Lat polygon = " << mp->toString() << endl;
      // Create the projection necessary for seeding
      PvlGroup radii = Projection::TargetRadii("MARS");
      Isis::Pvl maplab;
      maplab.addGroup(Isis::PvlGroup("Mapping"));
      Isis::PvlGroup &mapGroup = maplab.findGroup("Mapping");
      mapGroup += Isis::PvlKeyword("EquatorialRadius", (QString)radii["EquatorialRadius"]);
      mapGroup += Isis::PvlKeyword("PolarRadius", (QString)radii["PolarRadius"]);
      mapGroup += Isis::PvlKeyword("LatitudeType", "Planetocentric");
      mapGroup += Isis::PvlKeyword("LongitudeDirection", "PositiveEast");
      mapGroup += Isis::PvlKeyword("LongitudeDomain", toString(360));
      mapGroup += Isis::PvlKeyword("CenterLatitude", "0");
      mapGroup += Isis::PvlKeyword("CenterLongitude", "0");
      mapGroup += Isis::PvlKeyword("ProjectionName", "Sinusoidal");

      Projection *proj = Isis::ProjectionFactory::Create(maplab);

      /*
      This test doesn't make sense because there is no ground range on this
      projection.


      double x1,x2,y1,y2;
      proj->XYRange(x1,x2,y1,y2);
      if(fabs(x1) < 0.00000001) x1 = 0.0;
      if(fabs(x2) < 0.00000001) x2 = 0.0;
      if(fabs(y1) < 0.00000001) y1 = 0.0;
      if(fabs(y2) < 0.00000001) y2 = 0.0;
      std::cout << "X: " << x1 << "-" << x2 << " Y: " << y1 << "-" << y2 << std::endl;
      */

      geos::geom::MultiPolygon *xymp = PolygonTools::LatLonToXY(*mp, proj);
      vector<geos::geom::Point *> seedValues = ps->Seed(xymp);

      vector<geos::geom::Point *> points;
      for(unsigned int pt = 0; pt < seedValues.size(); pt ++) {
        if(proj->SetCoordinate(seedValues[pt]->getX(), seedValues[pt]->getY())) {
          points.push_back(Isis::globalFactory.createPoint(
                             geos::geom::Coordinate(proj->UniversalLongitude(),
                                 proj->UniversalLatitude())));
        }
        else {
          IString msg = "Unable to convert to a (lon,lat)";
          throw IException(IException::Programmer, msg, _FILEINFO_);
        }
      }

      cout << setprecision(13);
      for(unsigned int i = 0; i < points.size(); i++) {
        cout << "  POINT (";
        cout << points[i]->getX() << " " << points[i]->getY() << ")" << endl;
      }
//.........这里部分代码省略.........
开发者ID:corburn,项目名称:ISIS,代码行数:101,代码来源:unitTest.cpp


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