ossimProjection* ossimNitfProjectionFactory::makeEuiDistant( const ossimNitfImageHeader* hdr, const std::vector<ossimGpt>& gpts) const { ossimEquDistCylProjection* proj = 0; // Get the scale. ossimDpt scale; computeScaleInDecimalDegrees(hdr, gpts, scale); if (scale.hasNans()) { return proj; } // Make the projection. proj = new ossimEquDistCylProjection(); // Shift the tie to the center of the pixel. ossimGpt tiePoint; tiePoint.latd(gpts[0].latd() - (scale.y/2.0)); tiePoint.lond(gpts[0].lond() + (scale.x/2.0)); // Set the tie points. proj->setUlTiePoints(tiePoint); // Set the scale. proj->setDecimalDegreesPerPixel(scale); return proj; }
ossimProjection* ossimNitfProjectionFactory::makeEuiDistant( const ossimNitfImageHeader* hdr, const std::vector<ossimGpt>& gpts) const { ossimEquDistCylProjection* proj = 0; // Get the scale. ossimDpt scale; computeScaleInDecimalDegrees(hdr, gpts, scale); if (scale.hasNans()) { return proj; } // Make the projection. proj = new ossimEquDistCylProjection(); if ( scale.x ) { ossimGpt origin = proj->getOrigin(); //--- // ossimEquDistCylProjection uses the origin_latitude for meters per pixel (gsd) // computation. So is not set in tiff tags, compute to achieve the proper // horizontal scaling. //--- origin.lat = ossim::acosd(scale.y/scale.x); proj->setOrigin(origin); } // Shift the tie to the center of the pixel. ossimGpt tiePoint; tiePoint.latd(gpts[0].latd() - (scale.y/2.0)); tiePoint.lond(gpts[0].lond() + (scale.x/2.0)); // Set the tie points. proj->setUlTiePoints(tiePoint); // Set the scale. proj->setDecimalDegreesPerPixel(scale); ossimKeywordlist tempKwl; proj->saveState(tempKwl); std::cout << tempKwl << std::endl;; return proj; }
ossimProjection* ossimNitfProjectionFactory::makeGeographic( const ossimNitfImageHeader* hdr, const ossimString& coordinateSysetm) const { ossimProjection* proj = 0; if (hdr) { // To hold corner points. std::vector<ossimGpt> gpts; //--- // Get the corner points. // // Look for points from the BLOCKA tag. This may or may not be present. // If present since it has six digit precision use it for the points. //--- if ( getBlockaPoints(hdr, gpts) == false ) { ossimString geographicLocation = hdr->getGeographicLocation(); if ( geographicLocation.size() ) { if (traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimNitfProjectionFactory::makeGeographic DEBUG:" << "\ngeographicLocation: " << geographicLocation << std::endl; } if (coordinateSysetm == "G") { //--- // If coord system is G then format is: // Lat = ddmmssX // where d is degrees and m is minutes // and s is seconds and X is either N (North) or S (South). // Lon = dddmmssX // where d is degrees and m is minutes // and s is seconds and X is either N (North) or S (South). //--- parseGeographicString(geographicLocation, gpts); } else if (coordinateSysetm == "D") { //--- // If coor system is D then format is: // +-dd.ddd +-dd.ddd four times where + is northern hemispher and // - is souther hemisphere for lat and longitude // + is easting and - is westing. //--- parseDecimalDegreesString(geographicLocation, gpts); } } // matches: if ( geographicLocation.size() ) } // matches: if ( getBlockaPoints(hdr, gpts) == false ) if (gpts.size() == 4) { ossimDpt scaleTest; computeScaleInDecimalDegrees(hdr, gpts, scaleTest); if (!isSkewed(gpts)&&(ossim::abs(scaleTest.y/scaleTest.x) <= 1.0)) { proj = makeEuiDistant(hdr, gpts); } else { // Image is rotated. Make a Bilinear. proj = makeBilinear(hdr, gpts); } } if (traceDebug() && proj) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimNitfProjectionFactory::makeGeographic DEBUG:" << "\nUpper left corner: " << gpts[0] << "\nUpper right corner: " << gpts[1] << "\nLower right corner: " << gpts[2] << "\nLower left corner: " << gpts[3] << "\n"; proj->print( ossimNotify(ossimNotifyLevel_DEBUG)); } } // matches: if (hdr) return proj; }