本文整理汇总了C++中wxPaintDC::DrawCircle方法的典型用法代码示例。如果您正苦于以下问题:C++ wxPaintDC::DrawCircle方法的具体用法?C++ wxPaintDC::DrawCircle怎么用?C++ wxPaintDC::DrawCircle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxPaintDC
的用法示例。
在下文中一共展示了wxPaintDC::DrawCircle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void LaserPanelLayer::render(wxPaintDC &dc, const CoordScale &drawscale) const {
static wxPen pens[] = {
wxPen(*wxBLUE),
wxPen(*wxGREEN),
wxPen(*wxRED)
};
static wxBrush brushes[] = {
wxBrush(*wxBLUE),
wxBrush(*wxGREEN),
wxBrush(*wxRED)
};
for (int laser=0; laser < readings.size(); laser++) {
const LaserSensor::DistAngleVec &distangles = readings[laser];
for (LaserSensor::DistAngleVec::const_iterator i = distangles.begin(); i != distangles.end(); ++i) {
Coord coord = i->toCoord(M_PI/2);
Pos pos = drawscale.coordToPos(coord.x + 50, 100 - coord.y);
int num = min(laser, 3);
dc.SetPen(pens[num]);
dc.SetBrush(brushes[num]);
dc.DrawCircle(pos.x, pos.y, 1);
}
}
}
示例2: render
void RobotPanelLayer::render(wxPaintDC &dc, const CoordScale &drawscale) const {
const float minsize = min(drawscale.sx/gridscale.sx, drawscale.sy/gridscale.sy);
Pos pos = drawscale.coordToPos(robot.getPosition());
const float thickness = minsize * .3;
const float dir = robot.getDirection();
wxPoint points[3];
points[0].x = (int)(pos.x + thickness*cos(dir));
points[0].y = (int)(pos.y - thickness*sin(dir));
points[1].x = (int)(pos.x + thickness*cos(dir + 5*M_PI/4));
points[1].y = (int)(pos.y - thickness*sin(dir + 5*M_PI/4));
points[2].x = (int)(pos.x + thickness*cos(dir - 5*M_PI/4));
points[2].y = (int)(pos.y - thickness*sin(dir - 5*M_PI/4));
dc.DrawPolygon(3, points);
wxBrush victimbrush(wxColour(150, 200, 130));
const RoomPlanner::Plan &plan = robot.getPlan();
if (plan.identifyvictim)
dc.SetBrush(victimbrush);
const float radius = max(minsize*.1f, 3.0f);
for (int i = 0; i != plan.coords.size(); ++i) {
Pos p = drawscale.coordToPos(plan.coords[i]);
float dirrad = dirToRad(plan.facedirs[i]);
dc.DrawCircle(p.x, p.y, radius);
const float len = minsize*0.3;
const float endx = p.x+len*cos(dirrad);
const float endy = p.y-len*sin(dirrad);
dc.DrawLine(p.x, p.y, endx, endy);
dc.DrawCircle(endx, endy, 1);
}
const int crossdelta = (int)(minsize*0.15f);
const PosSet &victims = robot.getIdentifiedVictims();
for (PosSet::const_iterator i = victims.begin(); i != victims.end(); ++i) {
Pos pos = drawscale.coordToPos(victimscale.posToCoord(*i));
dc.DrawLine(pos.x-crossdelta, pos.y-crossdelta, pos.x+crossdelta+1, pos.y+crossdelta+1);
dc.DrawLine(pos.x-crossdelta, pos.y+crossdelta, pos.x+crossdelta+1, pos.y-crossdelta-1);
}
}