PlugIns? (#2) - Drawing lines in OnDraw? (#507) - Message List

Drawing lines in OnDraw?

I aplologise if this has been covered somewhere else already, I've looked but could find the answer though.

I'm working on 2 projects at the moment, 1 is a plug-in to FV and the other is a new application which uses the MapRenderingEngine component.

The plug-in was created using the new VS wizards and both are written in C#.

I can plot geo-referenced points/symbols OK but what I want to do now is draw a route using either GreatCircle? or Rhumbline so its projected properly on the map.

Is there a way to do this via the SDK or would I have to do the calculations myself and draw the lines inside the OnDraw?() method for the plug-in and the MapRenderingEngineCallback for the standalone app.

Thanks in advance for any help with this.

  • Message #1134

    Right, the old ILayer add line was able to add GeoLines? to the map for you. You have to do the divisions now manually since your overlay is drawing its own lines. The Geo2.dll has the calculations you need in it to divide the line.

    take a look at the line drawing in the open source FV version for drawing overlay -- it has to perform the same tasks.

    • Message #1159

      Thanks Daniel, thats what I thought but its usefull knowing where to start looking.

      I'll have a look in the Geo2.dll

    • Message #1135

      Hello,

      I'm a newbie and am having a similar issue, I would just like to draw random lines on the base map for now but i do not see any results. My code is below, does any one see any thing wrong with it? I know it's getting executed because it hits my break point. I'm using the IFvOverlayBaseMapRenderer interface.

      Thanks!

      • Mike
      STDMETHODIMP CCDBOverlay::raw_OnDraw (IFvMapView * pMapView, IUnknown* pActiveMap)
      {
      	IActiveMapProjPtr spActiveMap = pActiveMap;
      	ISettableMapProjPtr spMapProj;
      	spActiveMap->GetSettableMapProj(&spMapProj);
      	IGraphicsContextPtr spGC;
      	spActiveMap->GetGraphicsContext(&spGC);
      	long hdc, hAttribDC;
      	spGC->GetDC(&hdc, &hAttribDC);
      	HDC hDC = reinterpret_cast<HDC>(hdc);
      	// draw stuff to the device context using projected coordinate system
      	// transform (spMapProj) and the handle to the device context (hDC)
      	//
      	HDC hdcMem = CreateCompatibleDC(hDC);
      	SetDCBrushColor(hdcMem, RGB(255,0,0));
      	MoveToEx(hdcMem, 60, 20, NULL);
      	LineTo(hdcMem, 264, 120);
      	LineTo(hdcMem, 0, 0);
      	LineTo(hdcMem, 10, 10);
      	return S_OK;
      }
      
      • Message #1136

        Mike,

        You'll want to use IFvOverlayRenderer rather than IFvOverlayBaseMapRenderer.

        • Message #1138

          Hey George,

          Thanks for the quick response, the description for IFvOverlayRenderer states that it used to render an overlay, I would like to make changes to the actual base map's image file. Ex, I wish to load up image (like arizona) and add a red line to the image itself then save off. Would IFvOverlayRenderer allow me to do this?

          Thanks,

          • Mike
          • Message #1142

            The IFvOverlayBaseMapRenderer was really only intended for rendering alpha blended pixmaps to the base map. The TA Mask overlay is an example of an overlay that uses this. If you want to draw a red line of the map, say, then IFvOverlayRenderer is the way to go.

            That said, you won't be able to make changes to the base map's image file with either of those interfaces. They are simply used to render on top of a chart or imagery at run time.

          • Message #1143

            The IFvOverlayBaseMapRenderer was really only intended for rendering alpha blended pixmaps to the base map. The TA Mask overlay is an example of an overlay that uses this. If you want to draw a red line of the map, say, then IFvOverlayRenderer is the way to go.

            That said, you won't be able to make changes to the base map's image file with either of those interfaces. They are simply used to render on top of a chart or imagery at run time.

            • Message #1150

              Thanks for the info George,

              Does anyone know if it is even possible to use Falcon View to actually alter an image?

              Thanks,

              -Mike

Subscriptions