I am currently placing custom markers on a Google Map with the geoXML3 tool. I am very happy with how it all works, and the ease of generating the KML on the fly and having the marks show on my map.
Since my markers are custom, the 'origin point' is not necessarily the same for each mark. Is there a way with KML to specify the pixel position that gets used as the origin point when the marker is placed on the map?
For instance, all my custom markers are 32x32 PNGs. But the acual visible imagery is say 8x24, centered in the 32x32 area. I would like for my origin point for this marker to be (16,28), so that the bottom of my visible imagery is placed at the point specified in the KML Placemark attribute.
Any ideas?
The way to define that in KML is with the hotspot tag
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction">
Specifies the position within the Icon that is "anchored" to the <Point> specified in the Placemark. The x and y values can be specified in three different ways: as pixels ("pixels"), as fractions of the icon ("fraction"), or as inset pixels ("insetPixels"), which is an offset in pixels from the upper right corner of the icon. The x and y positions can be specified in different ways—for example, x can be in pixels and y can be a fraction. The origin of the coordinate system is in the lower left corner of the icon.
x - Either the number of pixels, a fractional component of the icon, or a pixel inset indicating the x component of a point on the icon.
y - Either the number of pixels, a fractional component of the icon, or a pixel inset indicating the y component of a point on the icon.
xunits - Units in which the x value is specified. A value of fraction indicates the x value is a fraction of the icon. A value of pixels indicates the x value in pixels. A value of insetPixels indicates the indent from the right edge of the icon.
yunits - Units in which the y value is specified. A value of fraction indicates the y value is a fraction of the icon. A value of pixels indicates the y value in pixels. A value of insetPixels indicates the indent from the top edge of the icon.
Related
I have shapes with integer coordinates of width and height. They can be selected and stretched separately, I want to add the function of stretching a group of selected shapes. For example, as in the Figma editor or in VS Studio on a visual canvas, when we select a set of shapes and stretch them and they stretch proportionally with integer coordinates of width and height. Can you tell me how it works? For example, I have a list of 5 shapes with a width and height of 10px, indents from each other in 1px, I have selected them and pull them along the X axis in the positive direction by 8 pixels, which algorithm do I need to use? Here is an example of how it looks in VS when stretching buttons on the canvas.
https://i.stack.imgur.com/mYOAf.gif
In my SVG picture there are some text labels that are displayed dynamically in top part of the image. In some cases (i.e. smaller screen size, bigger font size), they partially disappear outside the vievBox (like if overflow: hidden; was set) - see the picture (the long word in the middle is the overflowing label).
My idea is to scale down the image so that the labels are visible. How to achieve this?
In my case, I had quite wide bottom margin, so I could afford moving the whole image down to uncover the top part.
Final solution was wrapping the whole image with <g transform="translate(0,10)">.
The first value refers to left-right movement, the other one to up-down (positive values move the image down, negative - up).
I have images with unequal resolution in x and y direction. The pixel height is larger than the pixel width. The pixel width and pixel height are saved in Image > Properties.
When I draw an ellipse on the image and try to use the Analyze > Measure tool I get a '0' for both major and minor axis length for the "Fit ellipse" measurement.
I can only get a proper measurement if I remove the scale of the image, or manually change the pixel height and pixel width to an equal number.
I assume this is a bug, but maybe I'm missing something?
As a workaround I was thinking of writing a small macro that saves pixel height and pixel width, then removes the scale of the image, then measures major and minor axis length in pixel and then re-applies pixel height and pixel width to the measurements.
But I can't find the command for reading out the resolution. Any pointers?
The documentation for the Set Measurements... command states in the description of the Fit ellipse parameter:
Note that ImageJ cannot calculate the major and minor axis lengths if
Pixel Aspect Ratio in the Analyze▷Set Scale… dialog is not 1.0.
Your workaround should work, just use the getPixelSize(unit, pixelWidth, pixelHeight) macro function.
For drawing filled shapes like Rectangle, Eclipse need two values width and height (converted from int to float).
There's an enum,
Public enum Sizes : int
{
One=5,
Two=10,
Five=10,
Seven=12,
Ten=15,
}
In terms of drawing a Square of One, should be of width and height of 5. Which is straight forward. However when drawing Oval Shapes and Rectangular shapes above one value isn't sufficient.
Is there a way I could define another float value? So when compared for Ten, it can provide 15 for Width and 10 for Height...
Or does it mean, there should be two enums, one for Width and one for Height?
EDIT to provide more background info:
There's an UI which allows users to create certain shapes.
User inputs are: Shape Type (Line, Rectangle, Eclipse), Points, Size (but this size doesn't exactly reflect the size of the shape. e.g. 10 is a capacity. Capacity 10 must draw 15px Width and 10px height Rectangle/Eclipse).
Line doesn't take Size into account as it is drawn using the Points input. The rest of the shapes do take Size into account. So this is where I need to check the Size(capacity) parameter and issue the correct Width and Height to be drawn.
I need to place a label at the right, above of a fitted average horizontal rule. I have an y-coordinate of the rule, but i don't know the coordinate of the right border of the graph.
I saw, I could use at graph 0.5,0.8 syntax, only if the horizontal rule would be fixed, which it isn't.
You can use different coordinate systems for x and y values. The available coordinate systems are:
first: value on the left and bottom axes.
second: value on the right and top axes.
graph: relative to the area within the axes, 0,0 is bottom left and 1,1 is top right.
screen: relative to the entire canvas.
character: depends on the chosen font size.
So, if your x-value should be relative to the graph, use graph 0.5, for the y-value you can use first yval:
set label at graph 0.5, first yval+ofs
Here, yval is the y-value of the horizontal line, and ofs is an offset in order to displace the label a bit.