-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGDIRenderer.cpp
47 lines (32 loc) · 1.15 KB
/
GDIRenderer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//---------------------------------------------------------------------------
#pragma hdrstop
#include <algorithm>
#include <Vcl.Graphics.hpp>
#include "IModel.h"
#include "GDIRenderer.h"
#include "Utils.h"
using std::transform;
//---------------------------------------------------------------------------
#pragma package(smart_init)
namespace AreaPrj {
void GDIRenderer::DoPrepareRendering( IModel const & Model )
{
auto& Polygons = Model.GetPolygons();
PolygonCont GdiPolygons;
for ( auto const & Pol : Polygons ) {
GdiPolygons.push_back( ToGDIPolygon<Polygon>( Pol.outer() ) );
for ( auto const & RingInner : Pol.inners() ) {
GdiPolygons.push_back( ToGDIPolygon<Polygon>( RingInner ) );
}
}
polygons_ = std::move( GdiPolygons );
}
//---------------------------------------------------------------------------
void GDIRenderer::DoRender( Vcl::Graphics::TCanvas& Canvas ) const
{
for ( auto const & Polygon : polygons_ ) {
Canvas.Polyline( Polygon.data(), Polygon.size() - 1 );
}
}
//---------------------------------------------------------------------------
} // End of namespace AreaPrj