missioncommand / mil-sym-js

(RETIRED) MIL-STD-2525 symbol rendering JavaScript library for modern web applications
Apache License 2.0
76 stars 25 forks source link

Incorrect graphic rendering related to bbox #52

Closed ivanKyka closed 1 year ago

ivanKyka commented 1 year ago

Hi, @michael-spinelli ! I'm still working on migrating my application to web workers. When I check graphics, I found a few cases of incorrect rendering. I didn't find the source of the problem, but I think that is related to bbox which I pass into params

Expected result image

The current result which I have: image

Params which I pass into sec.web.renderer.SECWebRenderer.RenderSymbol2D:

    "id": "ID",
    "name": "",
    "description": "DESCR",
    "sidc": "GAGPOLAGM-----X",
    "points": "26.016182667994155,48.93776674802398 24.999947316431705,48.36439019575385 23.599190480494276,48.48468488803118 24.625140277622883,49.007371341140534",
    "pixelHeight": 1000,
    "pixelWidth": 1000,
    "bbox": "-32.6013710429282,26.756551592436782,91.06073833203895,64.44017897705172",
    "modifiers": {},
    "format": 2,
    "symstd": 1
ivanKyka commented 1 year ago

I think that problem is caused by PointConversion util. That utility is created from pixelHeight, pixelWidth and bbox. Maybe I pass the wrong params into the method call?

ivanKyka commented 1 year ago

Found it! PixelWidth and PixelHeight must be proportional to bbox width and height

michael-spinelli commented 1 year ago

Glad you found it! Sorry I didn't get a chance to look into it. Generally pixel width and height should match the pixel width and height of the map window but keeping it proportional to the bbox should probably work as well https://github.com/missioncommand/mil-sym-js/wiki/Developer%27s-Guide#3317pixelwidth--pixelheight-for-2d

ivanKyka commented 1 year ago

Maybe should write comments into samples? It will help for next users. Upd: Found it into docs! Thanks