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


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

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


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

示例1: userChangedBox

  void MosaicAreaTool::userChangedBox() {
    bool latValid = false;
    bool lonValid = false;
    bool areaValid = false;

    if(!m_latLineEdit || !m_lonLineEdit || !m_areaLineEdit) {
      clearBox();
      return;
    }

    QString latitude = m_latLineEdit->text();

    if(latitude != "Null" && latitude != "") {
      int cursorPos = 0;
      QValidator::State validLat =
        m_latLineEdit->validator()->validate(latitude, cursorPos);
      if(validLat != QValidator::Acceptable) {
        QMessageBox::warning(getWidget(), "Error",
                            "Latitude value must be in the range -90 to 90",
                            QMessageBox::Ok, QMessageBox::NoButton,
                            QMessageBox::NoButton);
      }
      else {
        latValid = true;
      }
    }

    //Validate longitude value
    QString longitude = m_lonLineEdit->text();
    if(longitude != "Null" && longitude != "" && latValid) {
      int cursorPos = 0;
      QValidator::State validLon =
        m_lonLineEdit->validator()->validate(longitude, cursorPos);
      if(validLon != QValidator::Acceptable) {
        QMessageBox::warning(getWidget(), "Error",
                            "Longitude value invalid",
                            QMessageBox::Ok, QMessageBox::NoButton,
                            QMessageBox::NoButton);
      }
      else {
        lonValid = true;
      }
    }

    QString areaString = m_areaLineEdit->text();
    if(areaString != "Null" && areaString != "" && latValid && lonValid) {
      int cursorPos = 0;
      QValidator::State validArea =
        m_areaLineEdit->validator()->validate(areaString, cursorPos);
      if(validArea != QValidator::Acceptable) {
        QMessageBox::warning(getWidget(), "Error",
                            "Area value invalid",
                            QMessageBox::Ok, QMessageBox::NoButton,
                            QMessageBox::NoButton);
      }
      else {
        areaValid = true;
      }
    }


    if(latValid && lonValid && areaValid) {
      double lat = IString(latitude.toStdString()).ToDouble();
      double lon = IString(longitude.toStdString()).ToDouble();
      double area = IString(areaString.toStdString()).ToDouble();

      Projection *projection = getWidget()->getProjection();
      Projection::ProjectionType ptype = projection->projectionType();

      if (projection && ptype == Projection::Triaxial) {
        TProjection * tproj = (TProjection *) projection;
        if (tproj->SetGround(lat, lon)) {
          QPointF scenePos(projection->XCoord(), -1 * projection->YCoord());
          QRectF sceneRect(getWidget()->getView()->sceneRect());

          if(sceneRect.contains(scenePos)) {
            if(m_box != NULL) {
              clearBox();
            }

            Distance distance(area, Distance::Meters);

            QPolygonF boxPoly;
            QRectF latLonRange = calcLatLonRange(QPointF(lon, lat), distance);

            double xStep = latLonRange.width() / 100.0;
            double yStep = latLonRange.height() / 100.0;

            bool hasPole = (latLonRange.top() == -90 ||
                            latLonRange.bottom() == 90);

            double yPos = latLonRange.top();
            if (yPos != -90) {
              for(double xPos = latLonRange.left();
                xPos <= latLonRange.right();
                xPos += xStep) {
                if (tproj->SetGround(yPos, xPos)) {
                  QPointF pos(tproj->XCoord(), -1 * tproj->YCoord());
                  boxPoly << pos;
                }
//.........这里部分代码省略.........
开发者ID:jlaura,项目名称:isis3,代码行数:101,代码来源:MosaicAreaTool.cpp

示例2: IsisMain


//.........这里部分代码省略.........
    double Cincid;
    double ClocalSolTime;
    double CsolarLong;
    double CsunAzimuth;
    double CnorthAzimuth;
    for (int i=0; i<(int)clist.size(); i++) {
      Camera *cam = clist[i]->Camera();
      if (cam->SetUniversalGround(avgLat,avgLon)) {
        Cemiss = cam->EmissionAngle();
        Cphase = cam->PhaseAngle();
        Cincid = cam->IncidenceAngle();
        ClocalSolTime = cam->LocalSolarTime();
        CsolarLong = cam->SolarLongitude();
        CsunAzimuth = cam->SunAzimuth();
        CnorthAzimuth = cam->NorthAzimuth();
        runXY = false;
        break;
      }
    }

    //The code within the if runXY was added in 10/07 to find an intersect with
    //pole images that would fail when using projection set universal ground.  
    // This is run if no intersect is found when using lat and lon in 
    // projection space.
    if (runXY) {
      double startX = DBL_MAX;
      double endX = DBL_MIN;
      double startY = DBL_MAX;
      double endY =  DBL_MIN;
      for (int i=0; i<(int)clist.size(); i++) {
        Projection *proj = clist[i]->Projection();
        proj->SetWorld(0.5,0.5);
        if (i==0) {
          startX = proj->XCoord();
          endY = proj->YCoord();
        }
        else {
          if (proj->XCoord() < startX) startX =  proj->XCoord();
          if (proj->YCoord() > endY) endY = proj->YCoord();
        }
        Pvl *p = clist[i]->Label();
        double nlines = p->FindGroup("Dimensions",Pvl::Traverse)["Lines"];
        double nsamps = p->FindGroup("Dimensions",Pvl::Traverse)["Samples"];

        proj->SetWorld((nsamps+0.5),(nlines+0.5));
        if (i==0) {
          endX = proj->XCoord();
          startY = proj->YCoord();
        }
        else {
          if (proj->XCoord() > endX) endX =  proj->XCoord();
          if (proj->YCoord() < startY) startY = proj->YCoord();
        }
      }

      double avgX = (startX + endX) / 2;
      double avgY = (startY + endY) / 2;
      double sample = proj->ToWorldX(avgX);
      double line = proj->ToWorldY(avgY);

      for (int i=0; i<(int)clist.size(); i++) {
        Camera *cam = clist[i]->Camera();
        if (cam->SetImage(sample,line)) {
          Cemiss = cam->EmissionAngle();
          Cphase = cam->PhaseAngle();
          Cincid = cam->IncidenceAngle();
开发者ID:assutech,项目名称:isis3,代码行数:67,代码来源:himos.cpp


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