Exemplo n.º 1
0
void roadmap_canvas3_ogl_prepare() {
   
   if (!isInitialized) {
		isInitialized= TRUE;
   }
	if ( !is_canvas_ready() )
	   return;

   roadmap_canvas3_ogl_updateScale(roadmap_math_get_zoom());
   roadmap_canvas_ogl_rotateMe(0);
}
Exemplo n.º 2
0
void roadmap_layer_adjust (void) {

   int i;
   int j;
   int k;
   int future_thickness;
   int thickness;
   struct roadmap_canvas_category *category;
   if (last_zoom == roadmap_math_get_zoom()) return;
   if (!RoadMapCategoryCount) return;

   last_zoom = roadmap_math_get_zoom();

   for (i = RoadMapCategoryCount; i > 0; --i) {

      category = RoadMapCategory + i;

      for (k=0; k<LAYER_PROJ_AREAS; k++) {

         if (roadmap_layer_is_visible(i, k)) {

            thickness =
               roadmap_math_thickness (category->thickness,
                     category->declutter,
                     k+1,
                     category->pen_count > 1);

            if (thickness <= 0) thickness = 1;
#ifdef VIEW_MODE_3D_OGL
            if (roadmap_screen_get_view_mode() == VIEW_MODE_3D)
               thickness *= 2;
#endif
            if (thickness > 40) thickness = 40;

#if !defined (OPENGL) && !defined (J2ME)
            if (roadmap_screen_fast_refresh()) {
               if (thickness && (thickness <= 4))
            	   thickness = 1;

#elif defined(J2ME)
            if (thickness && (thickness <= 4)) {
               thickness = 1;
            } else
#endif
            {

               /* As a matter of taste, I do dislike roads with a filler
                * of 1 pixel. Lets force at least a filler of 2.
                */
               future_thickness = thickness;

               for (j = 1; j < category->pen_count; ++j) {

                  if (category->delta_thickness[j] > 0) break;

                  future_thickness = category->thickness + category->delta_thickness[j];
                  if (future_thickness == 1) {
                     thickness += 1;
                  }
               }
            }
#if !defined (OPENGL) && !defined (J2ME)
          }
#endif

            if (k == 0) {
               roadmap_plugin_adjust_layer (i, thickness, category->pen_count);
            }

            if (thickness > 0) {
               roadmap_canvas_select_pen (category->pen[k][0]);
               roadmap_canvas_set_thickness (thickness);
            }

            category->in_use[k][0] = 1;
            for (j = 1; j < category->pen_count; ++j) {

               /* The previous thickness was already the minimum:
                * the pens that follow should not be used.
                */
               if (thickness <= 1) {
                  category->in_use[k][j] = 0;
                  continue;
               }

               if (category->delta_thickness[j] < 0) {

                  thickness += category->delta_thickness[j];
                  
#ifdef VIEW_MODE_3D_OGL
                  if (roadmap_screen_get_view_mode() == VIEW_MODE_3D/* &&
                      !roadmap_screen_fast_refresh()*/)
                     thickness += category->delta_thickness[j]*2; //increase the delta
#endif

               } else {
                  /* Don't end with a road mostly drawn with the latter
                   * pen.
                   */
                  if ((category->delta_thickness[j] >= thickness / 2) && (j != 2)) {
                     category->in_use[k][j] = 0;
                     thickness = 1;
                     continue;
                  }

                  thickness = category->delta_thickness[j];
               }

               /* If this pen is not visible, there is no reason
                * to draw it.
                */
               if (thickness < 1) {
                  category->in_use[k][j] = 0;
                  continue;
               }

               roadmap_canvas_select_pen (category->pen[k][j]);
               roadmap_canvas_set_thickness (thickness);
               category->in_use[k][j] = 1;
            }
         }
      }
   }
}