Element: graphic_window.rank

Type

numeric

Description

The rank for graphic_window. Only graphic entities with a rank less than or equal to this value are ever drawn in the window. It must have a value -32767 through +32767.

New graphic windows are given a rank equivalent to the system numeric def_rank, which is 0 at system startup.

Dynamic rank:

Using a rank tied to a window's meter scale enables a system of generalization to be adopted.

For example a polygon of 10,000 edges could be generalized to reduce unnecessary processing during rendering at smaller scales. The polygon could be duplicated and then generalized for meter scales of 1, 10 ,100 and 1000 meters-per-pixel. Each of the 4 polygons would then be given an appropriate rank of 1, 10, 100 or 1000. They would be then be saved in an entity file.

When the entity file was subsequently instanced, the graphic window would be marked as "dynamic" which means the value of window.rank will dynamically reflect the current meter-scale. Then only 1 of the 4 polygons would be displayed appropriate to the window scale. Consider the following code:

units = 'm'
# Create a red polygon, a circular pie with a chunk taken out
angle_mode='radians'
numeric nedges = 5000, radius = 3000
numeric ang, delta = 1.5*pi/nedges
epointer ep = polygon -ra=1, -fil=red {
   p0
   for i=1,nedges {
      (radius*sin(ang),radius*cos(ang),0)
      ang += delta;
   }
}
# Duplicate and generalize 3 times
# We fill them with different colors for illustration purposes
numeric scs[] = <10,100,1000>
string sfills[] = <'green','yellow','blue'>
for i=1,scs.alength {
   duplicate ep
   this.fill = ^(sfills[i])
# Generalize appropriately
   generalize scs[i],this
# Set the rank of the duplicated polygon
   this.rank = scs[i]
}
# Save them in an entity file (marked as generalized)
save polys,-gen
kill all
# Display in window
window w = wgraphic
w.dynamic_rank = 1
get polys; box; plan
# Then view it at various scales
w.mpp = 5; pause;    # Display at rank scale 1 (red)
w.mpp = 20; pause;   # Display at rank scale 10 (green)
w.mpp = 200; pause;  # Display at rank scale 100 (yellow)
w.mpp = 2000;        # Display at rank scale 1000 (blue)

Note: when a window is marked with "dynamic rank" then any entities with a rank of 0 or less will get displayed at all scales.

For the display of entities which are not within instanced entity files, the same visibility rules apply for a window with dynamic rank as for one with static rank, see above.

See Also

Commands:

get

Identifiers:

def_rank (numeric)

Structures:

entity.rank, window.dynamic_rank