>> Everything you need should already be encapsulated in QgsRenderContext
>> (and the QgsMapToPixel member).

For everything but degrees it is.
But in the case of degrees is is not
- there the (incorrect) assumption is being made that the world is flat
The value being used for DEGREE_TO_METER 111319.49079327358
- is only valid on the Equator
In my area a degree is around 66666,666666667 meters
- and this is the value needed

>> This shouldn't be implemented using an external dependency
I understand the reluctance to adding a further dependency, but GEOS is
also used
- and librttopo is an extension of GEOS

Unfortunately there are not many degree based functions that allows the
combination with a distance as meters.

---
Looking at the code yesterday, the following could be a realistic
possiblity to implement this:

QgsMapRenderer:
- add double mMeterAsMapUnit [default 1.0 for meters distance unit]
QgsMapRenderer::setDestinationCrs
// before setExtent is called:
 
mMeterAsMapUnit=QgsUnitTypes::fromUnitToUnitFactor(QGis::Meters,crs.mapUnits());
mRenderContext.setMeterAsMapUnit( mMeterAsMapUnit ) ;

QgsMapRenderer::setExtent

  if ( mSettings.destinationCrs().isGeographic() )
  { // Retrieve realistic MapUnits for a meter based on result of
QgsMapCanvas::center()
   // meterAsMapUnit=
  }

QgsRenderContext
add:
    /** 1 meter in Map-Unit*/
    double mMeterAsMapUnit;
    void setMeterAsMapUnit( double meterAsMapUnit ) {mMeterAsMapUnit =
meterAsMapUnit;}
    double meterAsMapUnit() const {return mMeterAsMapUnit;}

QgsSymbolLayerV2Utils::convertToMapUnits:

  switch ( unit )
  {
    case QgsSymbolV2::MetersUnit:
    { // Note: must fall through to QgsSymbolV2::MapUnit
     size=size*c.meterAsMapUnit();
    }
    case QgsSymbolV2::MapUnit:

I will try this out and see if it brings a reasonable result.

Mark Johnson, Berlin Germany
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to