rspfAnnotationFontObject::rspfAnnotationFontObject(const rspfIpt& upperLeft,
                                                     const rspfString& s,
                                                     const rspfIpt& pixelSize,
                                                     double rotation,
                                                     const rspfDpt& scale,
                                                     const rspfDpt& shear,
                                                     unsigned char r,
                                                     unsigned char g,
                                                     unsigned char b)
   :rspfAnnotationObject(r,g,b),
    theFont(rspfFontFactoryRegistry::instance()->getDefaultFont()),
    theString(s),
    thePixelSize(pixelSize),
    theRotation(rotation),
    theHorizontalScale(scale.x),
    theVerticalScale(scale.y),
    theHorizontalShear(shear.x),
    theVerticalShear(shear.y)
{
   setFontInfo();
   thePosition = upperLeft;
   computeBoundingRect();
#if 0
   if (theFont)
   {
      theFont->getBoundingBox(theBoundingRect);
   }
   theBoundingRect += upperLeft;
   thePosition = theBoundingRect.ul();
#endif
}
void rspfVpfAnnotationSource::setAllFeatures(const std::vector<rspfVpfAnnotationFeatureInfo*>& features)
{
  theFeatureList = features;
  
  computeBoundingRect();
  
}
示例#3
0
void ossimGeoAnnotationSource::transformObjects(ossimImageGeometry* geom)
{
    ossimRefPtr<ossimImageGeometry> tempGeom = geom;
    if(!tempGeom)
    {
        tempGeom = m_geometry.get();
    }

    if(!tempGeom) return;
    AnnotationObjectListType::iterator currentObject;

    currentObject = theAnnotationObjectList.begin();

    while(currentObject != theAnnotationObjectList.end())
    {
        // this is safe since we trapped all adds to make
        // sure that each object added to the list is
        // geographic.
        ossimGeoAnnotationObject* object = static_cast<ossimGeoAnnotationObject*>((*currentObject).get());

        // transform the object to image space.
        object->transform(m_geometry.get());

        ++currentObject;
    }
    computeBoundingRect();
}
示例#4
0
void rspfGeoPolyCutter::transformVertices()
{
   if(!theViewProjection) return;
   
   if(theGeoPolygonList.size())
   {
      if(theGeoPolygonList.size() != thePolygonList.size())
      {
         thePolygonList.resize(theGeoPolygonList.size());
      }
      int i = 0;
      int j = 0;
      for(i = 0; i < (int)theGeoPolygonList.size(); ++i)
      {
         rspfGeoPolygon& gpoly = theGeoPolygonList[i];
         rspfPolygon&    poly  = thePolygonList[i];
         int nvert = (int)gpoly.size();
         if((int)poly.getVertexCount() != nvert)
         {
            poly.resize(nvert);
         }
         for(j = 0; j < nvert; ++j)
         {
//	   rspfDpt error;
            theViewProjection->worldToLocal(gpoly[j], poly[j]);
//	    theViewProjection->getRoundTripError(rspfIpt(poly[j]), error);
//	    poly[j] = poly[j] + error;
            poly[j] = rspfDpt(rspf::round<int>(poly[j].x),
                               rspf::round<int>(poly[j].y));
         }
      }
      computeBoundingRect();
   }
}
void rspfAnnotationLineObject::setLine(const rspfDpt& start,
                                        const rspfDpt& end)
{
   theStart = start;
   theEnd   = end;
   computeBoundingRect();
}
示例#6
0
void CanvasElement::modelChanged()
{
  kDebug() ;//<< id();
  m_pen = QPen(Dot2QtConsts::componentData().qtColor(m_element->fontColor()));
  m_font = FontsCache::changeable().fromName(m_element->fontName());
  prepareGeometryChange();
  computeBoundingRect();
}
void rspfAnnotationLineObject::applyScale(double x, double y)
{
   theStart.x = rspf::round<int>(theStart.x*x);
   theStart.y = rspf::round<int>(theStart.y*y);
   theEnd.x   = rspf::round<int>(theEnd.x*x);
   theEnd.y   = rspf::round<int>(theEnd.y*y);
   computeBoundingRect();
}
示例#8
0
void rspfPolyCutter::setPolygon(const vector<rspfIpt>& polygon,
                                 rspf_uint32 index)
{
   if(polygon.size())
   {
      thePolygonList[index] = polygon;
      computeBoundingRect();
   }
}
void rspfAnnotationFontObject::applyScale(double x, double y)
{
   thePosition.x = rspf::round<int>(thePosition.x *x);
   thePosition.y = rspf::round<int>(thePosition.y *y);
   
   setFontInfo();
   computeBoundingRect();

}
示例#10
0
// rspfPolyCutter::rspfPolyCutter(rspfImageSource* inputSource,
//                                  rspfPolyArea2d* polygon)
rspfPolyCutter::rspfPolyCutter(rspfImageSource* inputSource,
                                 const rspfPolygon& polygon)
   : rspfImageSourceFilter(inputSource),
     theTile(NULL),
     theCutType(RSPF_POLY_NULL_INSIDE),
     m_boundingOverwrite(false)
{
   thePolygonList.push_back(polygon);
   computeBoundingRect();
   initialize();
}
ossimAnnotationMultiPolyObject::ossimAnnotationMultiPolyObject(const vector<ossimPolygon>& multiPoly,
        bool enableFill,
        unsigned char r,
        unsigned char g,
        unsigned char b,
        long thickness)
    :ossimAnnotationObject(r, g, b, thickness),
     theFillEnabled(enableFill)
{
    theMultiPolygon = multiPoly;
    computeBoundingRect();
}
rspfAnnotationLineObject::rspfAnnotationLineObject(const rspfIpt& start,
                                                     const rspfIpt& end,
                                                     unsigned char r,
                                                     unsigned char g,
                                                     unsigned char b,
                                                     long thickness)
   :rspfAnnotationObject(r, g, b, thickness),
    theStart(start),
    theEnd(end)
{
   computeBoundingRect();
}
void rspfGeoAnnotationMultiEllipseObject::transform(
   rspfImageGeometry* projection)
{
   const std::vector<rspfGpt>::size_type BOUNDS = thePointList.size();
   theProjectedObject->resize((rspf_uint32)BOUNDS);
   for(std::vector<rspfGpt>::size_type i = 0; i < BOUNDS; ++i)
   {
      projection->worldToLocal(thePointList[(int)i], (*theProjectedObject)[(int)i]);
      
   }
   computeBoundingRect();
}
rspfAnnotationPolyObject::rspfAnnotationPolyObject(
   const vector<rspfDpt>& imagePts,
   bool enableFill,
   rspf_uint8 r,
   rspf_uint8 g,
   rspf_uint8 b,
   rspf_uint8 thickness)
   :rspfAnnotationObject(r, g, b, thickness),
    theFillEnabled(enableFill)
{
   thePolygon = imagePts;
   computeBoundingRect();
}
void rspfAnnotationMultiEllipseObject::applyScale(double x, double y)
{
   int i;
   int upper = (int)thePointList.size();
   for(i = 0; i < upper; ++i)
   {
      thePointList[i].x *= x;
      thePointList[i].y *= y;
   }
   theWidthHeight.x *= x;
   theWidthHeight.y *= y;
   
   computeBoundingRect();
}
rspfAnnotationLineObject::rspfAnnotationLineObject(long x1,
                                                     long y1,
                                                     long x2,
                                                     long y2,
                                                     unsigned char r,
                                                     unsigned char g,
                                                     unsigned char b,
                                                     long thickness)
   :rspfAnnotationObject(r, g, b, thickness),
    theStart(x1, y1),
    theEnd(x2, y2)
{
   computeBoundingRect();
}
rspfAnnotationMultiEllipseObject::rspfAnnotationMultiEllipseObject
   (const std::vector<rspfDpt>& pointList,
    const rspfDpt& widthHeight,
    bool enableFill,
    unsigned char r,
    unsigned char g,
    unsigned char b,
    long thickness)
   :
         rspfAnnotationObject(r, g, b, thickness),
         thePointList(pointList),
         theWidthHeight(widthHeight),
         theFillFlag(enableFill)
{
   computeBoundingRect();
}
示例#18
0
bool ossimGeoAnnotationSource::addObject(ossimAnnotationObject* anObject)
{
    ossimGeoAnnotationObject *objectToAdd = PTR_CAST(ossimGeoAnnotationObject, anObject);

    if(objectToAdd)
    {
        ossimAnnotationSource::addObject(objectToAdd);
        if(m_geometry.valid())
        {
            objectToAdd->transform(m_geometry.get());
            computeBoundingRect();
        }
        return true;
    }

    return false;
}
示例#19
0
void CanvasElement::initialize(qreal scaleX, qreal scaleY,
                            qreal xMargin, qreal yMargin, qreal gh,
                            qreal wdhcf, qreal hdvcf)
{
//   kDebug();
  setFlag(QGraphicsItem::ItemIsMovable, true);
  setFlag(QGraphicsItem::ItemIsSelectable, true);

  m_scaleX = scaleX; m_scaleY = scaleY;
  m_xMargin = xMargin; m_yMargin = yMargin;
//   m_gh = gh;
  m_wdhcf = wdhcf; m_hdvcf = hdvcf;

  setZValue(m_element->z());

  computeBoundingRect();
}
示例#20
0
bool rspfPolyCutter::loadState(const rspfKeywordlist& kwl,
                                const char* prefix)
{
   const char* numberPolygons = kwl.find(prefix, NUMBER_POLYGONS_KW);

   rspfString newPrefix;
   if(numberPolygons)
   {
      thePolygonList.clear();
      int npolys = rspfString(numberPolygons).toLong();
      for(int i = 0; i < npolys;++i)
      {
         thePolygonList.push_back(rspfPolygon());
         
         newPrefix = rspfString(prefix) + "polygon" + rspfString::toString(i)+".";
         
         thePolygonList[i].loadState(kwl, newPrefix.c_str());
      }
   }

   const char* lookup = kwl.find(prefix,
                                 "cut_type");
   if(lookup)
   {
      theCutType = RSPF_POLY_NULL_INSIDE;
      rspfString test = lookup;
      if(test == "null_outside")
      {
         theCutType = RSPF_POLY_NULL_OUTSIDE;
      }
   }
   else
   {
      theCutType = RSPF_POLY_NULL_OUTSIDE;
   }

   computeBoundingRect();

   
   return rspfImageSourceFilter::loadState(kwl, prefix);
}
void rspfVpfAnnotationSource::transformObjects(rspfImageGeometry* geom)
{
   if(traceDebug())
   {
      rspfNotify(rspfNotifyLevel_DEBUG) << "rspfVpfAnnotationSource::transformObjects DEBUG: entered..." << std::endl;
   }
   rspfImageGeometry* tempGeom = geom;
   
   if(!tempGeom)
   {
      tempGeom = m_geometry.get();
   }
   
   if(!tempGeom) return;
   for(int idx = 0; idx < (int)theLibraryInfo.size(); ++idx)
   {
      theLibraryInfo[idx]->transform(tempGeom);
   }
   computeBoundingRect();
   if(traceDebug())
   {
      rspfNotify(rspfNotifyLevel_DEBUG) << "rspfVpfAnnotationSource::transformObjects DEBUG: leaving..." << std::endl;
   }
}
ossimAnnotationMultiPolyObject::ossimAnnotationMultiPolyObject()
    :ossimAnnotationObject(),
     theFillEnabled(false)
{
    computeBoundingRect();
}
void rspfAnnotationMultiEllipseObject::setWidthHeight(const rspfDpt& widthHeight)
{
   theWidthHeight = widthHeight;
   computeBoundingRect();
}
示例#24
0
void rspfPolyCutter::addPolygon(const rspfPolygon& polygon)
{
   thePolygonList.push_back(rspfPolygon(polygon));
   computeBoundingRect();
}
void rspfAnnotationPolyObject::applyScale(double x, double y)
{
   thePolygon      *= rspfDpt(x, y);
   computeBoundingRect();
}
void ossimGeographicAnnotationGrid::setViewProjectionInformation(ossimMapProjection* projection,
                                                                 const ossimGrect& boundingGroundRect)
{
   static const char* MODULE = "ossimGeographicAnnotationGrid::setViewProjectionInformation";
   theViewProjection = projection;

   // set the ground and then stretch it
   // to cover which even degree grid we are currently
   // in.
   theGroundRect     = boundingGroundRect;

   // find the even degree grid.
   ossimGrect rect(ossimGpt(90, -180),
                   ossimGpt(-90, 180));

   // make sure that it is within the range of the
   // geographic grid.
   ossimGrect clipRect = rect.clipToRect(boundingGroundRect);

   // for easier math we will shift the points so they
   // are between 0..360Lon and 0..180Lat.  This way
   // we are working with just positive numbers
   double upperLeftLonShift   = clipRect.ul().lond() + 180;
   double upperLeftLatShift   = clipRect.ul().latd() + 90;
   double lowerRightLonShift   = clipRect.lr().lond() + 180;
   double lowerRightLatShift   = clipRect.lr().latd() + 90;

   // now find the even boundaries
   double upperLeftLonCell = floor(upperLeftLonShift/theDeltaLonSpacing)*
                             theDeltaLonSpacing;
   double upperLeftLatCell  = floor(upperLeftLatShift/theDeltaLatSpacing)*
                              theDeltaLatSpacing;
   double lowerRightLonCell = floor(lowerRightLonShift/theDeltaLonSpacing)*
                              theDeltaLonSpacing;
   double lowerRightLatCell  = floor(lowerRightLatShift/theDeltaLatSpacing)*
                               theDeltaLatSpacing;

   // now adjust them by 1 boundary distance.
   upperLeftLonCell  -= theDeltaLonSpacing;
   upperLeftLatCell  += theDeltaLatSpacing;
   lowerRightLonCell += theDeltaLonSpacing;
   lowerRightLatCell -= theDeltaLatSpacing;

   // now clamp to the range of the lat and lon
   upperLeftLonCell  = (upperLeftLonCell<0?0:upperLeftLonCell);
   upperLeftLatCell  = (upperLeftLatCell>180?180:upperLeftLatCell);
   lowerRightLonCell = (lowerRightLonCell>360?360:lowerRightLonCell);
   lowerRightLatCell = (lowerRightLatCell<0?0:lowerRightLatCell);

   // now shift them back into range
   upperLeftLonCell  -= 180;
   upperLeftLatCell  -= 90;
   lowerRightLonCell -= 180;
   lowerRightLatCell -= 90;
   
   const ossimDatum* datum = theGroundRect.ul().datum();
   theGroundRect = ossimGrect(upperLeftLatCell, upperLeftLonCell,
                              lowerRightLatCell, lowerRightLonCell,
                              datum);

   if(traceDebug())
   {
      CLOG << "Ground Rect: " << theGroundRect << endl;
   }
   computeBoundingRect();
}