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

Quest regarding bbox #9

Closed solowt closed 8 years ago

solowt commented 8 years ago

Hi, I'm trying to use this library to draw tactical graphics, with limited success. Part of the problem (I think) comes down to bounding box issues.

First, in the developer's guide, it says that a bbox is an optional parameter, but I'm unsure how get the renderer to work without one.

Second, I've also had some issues when I try to pass in a bbox. Should a bbox be equal to the bottom left and top right coordinates of the map window at whatever zoom I'm interested in (ie xmin,ymin,xmax,ymax)? Or should it be the smallest rectangle that contains all the graphic's points? Should I generate a new bbox for each graphic I draw?

Thanks, Thomas

michael-spinelli commented 8 years ago

Well, for RenderSymbol2D() it's required. For RenderSymbol() it should function without it. Although it works best when one is provided. The bbox represents the visible bounds of the map area. When your view changes, the bbox changes. You don't need to have an individual bbox for each symbol on the map.

3.3.1.8 BOUNDING BOX (FOR 3D & 2D) bbox = the viewable area of the map. Passed in the format of a string "lowerLeftX,lowerLeftY,upperRightX,upperRightY." example: "-50.4,23.6,-42.2,24.2"

Also, scale refers to map scale. It is not a multiplier. I hear from a lot of people that pass in '1' for scale. This may or may not be relevant to you but I thought I'd mention it.

3.3.1.6 SCALE (FOR 3D) scale = a number corresponding to how many meters one meter of our map represents. A value "50000" would mean 1:50K which means for every meter of our map it represents 50000 meters of real world distance.

solowt commented 8 years ago

Thanks! I'm working in 2D right now, so I don't need to worry about scale, just the pixel dimensions of the map, correct?

michael-spinelli commented 8 years ago

Correct, for RenderSymbol2D(), you don't need scale.

solowt commented 8 years ago

Everything working now, thanks for the clarification.