Draw Map Image

Hi,

we had an interesting question for the small map view in the left down corner.
How to get this images?

There is no finish method to get this image, but we have made a samll example to show how you can draw it in your own application:

//create a new instance of PCB-Investigator
IPCBIWindow window = PCBI.Automation.IAutomation.CreateNewPCBIWindow(false);

window.LoadODBJob(@"C:\D\Jobs\2013\DEMO2013"); //load job

IStep step = window.GetCurrentStep();
GraphicsPath outline = step.GetPCBOutline();

Bitmap bmp = new Bitmap(1000, 1000);

Graphics g = Graphics.FromImage(bmp);

Matrix transformMatrix = new Matrix(); //we need to transfrom the visible area

RectangleF BoundsStep = step.GetBounds();
transformMatrix.Scale((float)bmp.Width / BoundsStep.Width, (float)bmp.Height / BoundsStep.Height);
transformMatrix.Translate(-BoundsStep.X, -BoundsStep.Y);
g.Transform = transformMatrix;
g.Clear(Color.White); //we use white background
g.DrawPath(Pens.Black, outline); //board outline in black

RectangleF drawnRect = window.GetVisibleArea(); //and then add visible area in red
g.FillRectangle(Brushes.DarkRed, drawnRect.X, drawnRect.Y, drawnRect.Width, drawnRect.Height);
g.DrawRectangle(Pens.Red, drawnRect.X, drawnRect.Y, drawnRect.Width, drawnRect.Height); //with red border

Taxonomy upgrade extras: 
Forums: 

looks very interesting, in the same way we can add graphic path of components or draw traces in the image.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.