glob3mobile / g3m

The multiplatform advanced visualization framework
http://www.glob3mobile.com/
Other
116 stars 56 forks source link

Mark Text #108

Closed dtvasquez closed 9 years ago

dtvasquez commented 9 years ago

Is it possible to define a background color for the Mark text? Is there a setting for the font style, such as bold or italics?

Sometimes it can be difficult to see the marker text, and being able to set a background can help a lot. Something similar to the following: markertext markertext2

DiegoGomezDeck commented 9 years ago

You can use a LabelImageBuilder...

  LabelImageBuilder(const std::string& text,
                    const GFont&       font            = GFont::sansSerif(),
                    const float        margin          = 0,
                    const Color&       color           = Color::white(),
                    const Color&       shadowColor     = Color::transparent(),
                    const float        shadowBlur      = 0,
                    const float        shadowOffsetX   = 0,
                    const float        shadowOffsetY   = 0,
                    const Color&       backgroundColor = Color::transparent(),
                    const float        cornerRadius    = 0,
                    const bool         isMutable       = false)

...after you get the image (after calling build() method), you can create a Mark with a given IImage using the constructor:

  /**
   * Creates a mark with a given pre-renderer IImage
   */
  Mark(const IImage*      image,
       const std::string& imageID,
       const Geodetic3D&  position,
       AltitudeMode       altitudeMode,
       double             minDistanceToCamera=4.5e+06,
       MarkUserData*      userData=NULL,
       bool               autoDeleteUserData=true,
       MarkTouchListener* listener=NULL,
       bool               autoDeleteListener=false);

For the records: We'd like to refactor soon the current Mark() to use the IImageBuilder hierarchy. IImageBuilder subframework gives much more options and flexibility to build IImages.

dtvasquez commented 9 years ago

That's actually perfect! Thank you, again.