missioncommand / mil-sym-java

(RETIRED) MIL-STD-2525 B and C rendering library and web service
Apache License 2.0
67 stars 36 forks source link

Center HQ On Staff with Direction of Movement #68

Closed david-melendez closed 7 years ago

david-melendez commented 7 years ago

The renderer has a setting that defines where the center of a symbol is based on the Center HQ on Staff setting. This setting is true by default and basically means that if a symbol is made an HQ, the center of the symbol is the free end of the staff. This appears to be working correctly until I add a value for the Direction of Movement modifier.

The figure below shows a hostile ARMOR symbol that is marked as an HQ. Note that the free end of the staff is located on a dot on the map. This is the correct location.

centeronhqstaff1

If I turn off the HQ setting, the center of the symbol is changed is the display looks like the below picture. Again, this is correct.

centeronhqstaff2

However, if I set the HQ back on and add a direction of movement value of 180, this is what is shown on the display. This is incorrect.

centeronhqstaff3

Another example with the Direction of Movement set to 90.

centeronhqstaff4

I am using the center information returned from the java renderer to determine where to draw the symbol. The exact coordinates of the symbol is always the same. In my application, I convert the lat/lon coordinate of the symbol to an x/y value to draw on the map via a Graphics object. The final x/y value is adjusted based on the center of the bitmap.

// pt is the coordinate of the symbol converted to X/Y point
// symbol is a class in my project; AnchorXY is the center info returned from the renderer
float xCoord = pt.X - symbol.AnchorXY.X;
float yCoord = pt.Y - symbol.AnchorXY.Y

MapGraphics.DrawImage(image, (int)Math.Round(xCoord),
           (int)Math.Round( yCoord));

The information I am receiving from the renderer for the four above examples is:

If appears that if the HQ flag is set, the render will always set the X value of the symbol to -1 (at least for Hostile symbols) and the Y value to the height of the symbol -1 (again, at least for Hostile symbols).

Can you please verify my findings and hypothesis for this issue?

michael-spinelli commented 7 years ago

I have an idea of what's going on. I'll take a look.

michael-spinelli commented 7 years ago

Found the issue. I should be able to check in a fix by Monday.

david-melendez commented 7 years ago

Great!

michael-spinelli commented 7 years ago

Fixed checked in 3/31, It will be in next release, 0.1.24