本文整理汇总了C++中Symbol::GetPrimitives方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbol::GetPrimitives方法的具体用法?C++ Symbol::GetPrimitives怎么用?C++ Symbol::GetPrimitives使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol::GetPrimitives方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawSymbol
void MapPainterCanvas::DrawSymbol(const Projection& projection,
const MapParameter& parameter, const Symbol& symbol,
double x, double y)
{
double minX;
double minY;
double maxX;
double maxY;
symbol.GetBoundingBox(minX,minY,maxX,maxY);
for (std::list<DrawPrimitiveRef>::const_iterator p=symbol.GetPrimitives().begin();
p!=symbol.GetPrimitives().end();
++p) {
FillStyleRef fillStyle=(*p)->GetFillStyle();
DrawPrimitivePath(projection,
parameter,
*p,
x, y,
minX,
minY,
maxX,
maxY);
DrawFillStyle(projection,
parameter,
*fillStyle);
}
}
示例2: DrawSymbol
void MapPainterAgg::DrawSymbol(const Projection& projection,
const MapParameter& parameter,
const Symbol& symbol,
double x, double y)
{
double minX;
double minY;
double maxX;
double maxY;
double centerX;
double centerY;
symbol.GetBoundingBox(minX,minY,maxX,maxY);
centerX=maxX-minX;
centerY=maxY-minY;
for (std::list<DrawPrimitiveRef>::const_iterator p=symbol.GetPrimitives().begin();
p!=symbol.GetPrimitives().end();
++p) {
DrawPrimitive* primitive=p->Get();
if (dynamic_cast<PolygonPrimitive*>(primitive)!=NULL) {
PolygonPrimitive* polygon=dynamic_cast<PolygonPrimitive*>(primitive);
FillStyleRef style=polygon->GetFillStyle();
agg::path_storage path;
for (std::list<Coord>::const_iterator pixel=polygon->GetCoords().begin();
pixel!=polygon->GetCoords().end();
++pixel) {
if (pixel==polygon->GetCoords().begin()) {
path.move_to(x+projection.ConvertWidthToPixel(pixel->x-centerX),
y+projection.ConvertWidthToPixel(maxY-pixel->y-centerY));
}
else {
path.line_to(x+projection.ConvertWidthToPixel(pixel->x-centerX),
y+projection.ConvertWidthToPixel(maxY-pixel->y-centerY));
}
}
path.close_polygon();
rasterizer->add_path(path);
DrawFill(projection,
parameter,
*style,
path);
}
else if (dynamic_cast<RectanglePrimitive*>(primitive)!=NULL) {
RectanglePrimitive* rectangle=dynamic_cast<RectanglePrimitive*>(primitive);
FillStyleRef style=rectangle->GetFillStyle();
agg::path_storage path;
double xPos=x+projection.ConvertWidthToPixel(rectangle->GetTopLeft().x-centerX);
double yPos=y+projection.ConvertWidthToPixel(maxY-rectangle->GetTopLeft().y-centerY);
double width=projection.ConvertWidthToPixel(rectangle->GetWidth());
double height=projection.ConvertWidthToPixel(rectangle->GetHeight());
path.move_to(xPos,yPos);
path.line_to(xPos+width,yPos);
path.line_to(xPos+width,yPos+height);
path.line_to(xPos,yPos+height);
path.close_polygon();
rasterizer->add_path(path);
DrawFill(projection,
parameter,
*style,
path);
}
else if (dynamic_cast<CirclePrimitive*>(primitive)!=NULL) {
CirclePrimitive* circle=dynamic_cast<CirclePrimitive*>(primitive);
FillStyleRef style=circle->GetFillStyle();
agg::path_storage path;
double radius=projection.ConvertWidthToPixel(circle->GetRadius());
agg::ellipse ellipse(x+projection.ConvertWidthToPixel(circle->GetCenter().x-centerX),
y+projection.ConvertWidthToPixel(maxY-circle->GetCenter().y-centerY),
radius,
radius);
path.concat_path(ellipse);
rasterizer->add_path(path);
DrawFill(projection,
parameter,
*style,
path);
}
}
}
示例3: DrawContourSymbol
void MapPainterCanvas::DrawContourSymbol(const Projection& projection,
const MapParameter& parameter,
const Symbol& symbol,
double space,
size_t transStart, size_t transEnd)
{
double lineLength=0;
int numPoints=transEnd-transStart+1;
double *onPathX=new double[numPoints];
double *onPathY=new double[numPoints];
double *segmentLengths=new double[numPoints-1];
for(int i=0; i<numPoints; i++)
{
onPathX[i]=(double)transBuffer.buffer[transStart+i].x;
onPathY[i]=(double)transBuffer.buffer[transStart+i].y;
if (i!=0)
segmentLengths[i-1]=sqrt(pow(onPathX[i]-onPathX[i-1], 2.0)+
pow(onPathY[i]-onPathY[i-1], 2.0));
lineLength+=segmentLengths[i-1];
}
double minX;
double minY;
double maxX;
double maxY;
symbol.GetBoundingBox(minX,minY,maxX,maxY);
double width=ConvertWidthToPixel(parameter,maxX-minX);
double height=ConvertWidthToPixel(parameter,maxY-minY);
for (std::list<DrawPrimitiveRef>::const_iterator p=symbol.GetPrimitives().begin();
p!=symbol.GetPrimitives().end();
++p)
{
FillStyleRef fillStyle=(*p)->GetFillStyle();
double offset=space/2;
while (offset+width<lineLength)
{
DrawPrimitivePath(projection,
parameter,
*p,
offset+width/2,
0,
minX,
minY,
maxX,
maxY,
onPathX, onPathY,
segmentLengths);
DrawFillStyle(projection,
parameter,
*fillStyle);
offset+=width+space;
}
}
}