Closed Longri closed 8 years ago
The default 400px is the product of 20x20px symbol size at base dpi.
Which for symbols in VTM is 160dpi (and not CanvasAdapter
's 240dpi).
The existed calculation has been tested thoroughly in Mapsforge, without problems for aspect ratio or anything else. And that's why it includes the icon surface pixels and not separately the sides.
So can you explain what's the issue here?
BTW have you checked PR #72 in various dpi? The arbitrary value of 13 produces either very large or very small icons.
The existed calculation has been tested thoroughly in Mapsforge, without problems for aspect ratio or anything else. And that's why it includes the icon surface pixels and not separately the sides.
Then I thing I must create a ISSUE on Mapsforge then this calculation produce same size for different squares
So can you explain what's the issue here?
See Table! Different SVG-size produce the same result for Bitmap-size!
The arbitrary value of 13 produces very small icons.
Play with this factor so you have a good size!
Oh you change to
either very large or very small icons.
So I think we must bring all SVG's to the same size (Maybe 580x580)
Then I thing I must create a ISSUE an Mapsforge
Yes that should be done, in case of error as the calculation is common.
this calculation produce same size for different squares
Please provide some examples to test, simple spreadsheet numbers are not visual results.
See Table! Different SVG-size produce the same result for Bitmap-size!
As different you mean the SVG canvas size, like the 580x580? They supposed to produce the same result, as we want to have 20x20px symbols at base dpi.
Play with this factor so you have a good size!
Sorry but we don't mean to use arbitrary numbers as factors for calculating a value. The preferred way is always a complete algorithm with understandable and reproducible results.
The existing is like that and can be modified if not working properly, but without fixed values. Also we could make default size not final, for users to modify it as they wish.
Or better, all SVG's have 30x30 and we don't need a factor!
The Excel sheet!
Thanks, I checked the spreadsheet. We need to clarify that the svg virtual canvas size (e.g. as seen in Inkscape) has nothing to do with the actual symbol size which we want to achieve on the map view. So both a 580x580 and a 58x58 svg are supposed to be rendered with the same 20x20px base size, keeping the aspect ratio. That was the whole purpose from the beginning.
Do you want to make the DEFAULT_SIZE
as public
and not final
for convenience?
No! I thing the better way is to have the same SVG-size! So maybe the Themer have a little impact on the size! Just as they have it in .png ! A bigger *.png is indeed drawn even bigger, right?
I will look into the SVG collection and maybe bring all to the same size! (30x30)?
Sorry I don't understand what you mean or need to do.
SVG files are not supposed to be modified for size, that's a work for the client renderer.
Please explain in detail what is the issue here.
The default size? That can be fixed by letting users change DEFAULT_SIZE
.
Also note that in Mapsforge we have extra symbol tags like width, height, percent to provide additional size adjustments per symbol.
@Longri a friendly reminder, please don't start making changes in the library without first discussing the purpose or the need of them.
That would save you and all valuable time, a discussion must always be preceded for better understanding.
This scaling strategy can only use for the map. I cannot use for a normal SVG.
I have an SVG, which I want to present, but no matter what I specify a size, the result is always the same small bitmap!
^^^^
At the moment they don't need any calculation of size because the result is always the same!
float scaleFactor = CanvasAdapter.dpi / 160;
double scale = scaleFactor / Math.sqrt((picture.getHeight() * picture.getWidth()) / DEFAULT_SIZE);
float bitmapWidth = (float) (picture.getWidth() * scale);
float bitmapHeight = (float) (picture.getHeight() * scale);
This scaling strategy can only use for the map. I cannot use for a normal SVG.
How is this related to the map library? :smile: External use of SVG libraries can be done via their own API, using probably the existing size calculation.
And it's important what dpi the device put on CanvasAdapter
and which DEFAULT_SIZE
you use.
So I must write all SVG stuff new so I don't need the VTM!
We don't understand each other. :smile:
Do VTM or Mapsforge have any issues with SVG rendering in the map?
I Understand this!
But wenn I will use SVG for normal, I must write all CanvasAdapter, Bitmap, SvgBitmap..... new! To Work with usage of Width and Height from SVG!
You want to render SVG in a platform and do that via a map library (VMT) instead of using directly the SVG library?
I want use both Map and SVG
Let's leave the map for the moment, that either works or not.
To render externally SVG in a platform is as easy as using the code inside each static XSvgBitmap.getResourceBitmap
method which returns a native platform bitmap, i.e. Android Bitmap
, Java BufferedImage
, etc.
And that could probably need modifications if used for other purposes, but it's still one method to handle locally.
Ok, ignore this PR! I will rename the Issue to “CanvasAdapter.decodeSvgBitmap(Inputstream inputstream) ignores the SVG specific Width and Height” And maybe it will fix later!
I will override the CanvasAdapter for myself! Too bad!
Still don't understand what the actual problem is.
Is VTM (and Mapsforge) map works correctly with SVG rendering, Yes or No? That is important for the repository.
Using externally a map library method in your own unspecified and unsupported code, needs to first understand the algorithms.
i.e. change of symbol size is done simply by setting different value to DEFAULT_SIZE
.
Closing also the issue.
Please discuss in the forum first, explaining with Map screenshots the problem to understand what can be done, if needed.
@Longri see also #74.
The scale of SVG's is not only dependent on CanvasAdapter.dpi but also from the aspect ratio!
A square is always the same size no matter what size is specified in the SVG file!
Most SVG's, in the theme have a size of 580x580. With a CanvasAdapter.dpi = 240, the bitmap size will always 30x30, even the size is set to 100x100 or 58x58 in SVG!
EXEL Example:![image](https://cloud.githubusercontent.com/assets/2542295/16913555/8dfd6760-4ceb-11e6-81d8-6d12a7e68cd9.png)
72