本文整理汇总了C++中RS_Pen函数的典型用法代码示例。如果您正苦于以下问题:C++ RS_Pen函数的具体用法?C++ RS_Pen怎么用?C++ RS_Pen使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RS_Pen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RS_Pen
/**
* Initialize (called by all constructors)
*/
void RS_Snapper::init()
{
snapMode = graphicView->getDefaultSnapMode();
keyEntity = nullptr;
pImpData->snapSpot = RS_Vector{false};
pImpData->snapCoord = RS_Vector{false};
m_SnapDistance = 1.0;
RS_SETTINGS->beginGroup("/Appearance");
snap_indicator->lines_state = RS_SETTINGS->readNumEntry("/indicator_lines_state", 1);
snap_indicator->lines_type = RS_SETTINGS->readEntry("/indicator_lines_type", "Crosshair");
snap_indicator->shape_state = RS_SETTINGS->readNumEntry("/indicator_shape_state", 1);
snap_indicator->shape_type = RS_SETTINGS->readEntry("/indicator_shape_type", "Circle");
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("Colors");
QString snap_color = RS_SETTINGS->readEntry("/snap_indicator", Colors::snap_indicator);
RS_SETTINGS->endGroup();
snap_indicator->lines_pen = RS_Pen(RS_Color(snap_color), RS2::Width00, RS2::DashLine2);
snap_indicator->shape_pen = RS_Pen(RS_Color(snap_color), RS2::Width00, RS2::SolidLine);
snap_indicator->shape_pen.setScreenWidth(1);
snapRange=getSnapRange();
}
示例2: RS_MTextData
/**
* Testing function.
*/
void LC_SimpleTests::slotTestInsertMText() {
RS_DEBUG->print("%s\n: begin\n", __func__);
RS_Document* d = QC_ApplicationWindow::getAppWindow()->getDocument();
if (d) {
RS_Graphic* graphic = (RS_Graphic*)d;
if (graphic==NULL) {
return;
}
RS_MText* text;
RS_MTextData textData;
textData = RS_MTextData(RS_Vector(10.0,10.0),
10.0, 100.0,
RS_MTextData::VATop,
RS_MTextData::HALeft,
RS_MTextData::LeftToRight,
RS_MTextData::Exact,
1.0,
"LibreCAD",
"iso",
0.0);
text = new RS_MText(graphic, textData);
text->setLayerToActive();
text->setPen(RS_Pen(RS_Color(255, 0, 0),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(text);
}
RS_DEBUG->print("%s\n: end\n", __func__);
}
示例3: RS_ImageData
/**
* Testing function.
*/
void LC_SimpleTests::slotTestInsertImage() {
RS_DEBUG->print("%s\n: begin\n", __func__);
RS_Document* d = QC_ApplicationWindow::getAppWindow()->getDocument();
if (d) {
RS_Graphic* graphic = (RS_Graphic*)d;
if (graphic==NULL) {
return;
}
RS_Image* image;
RS_ImageData imageData;
imageData = RS_ImageData(0, RS_Vector(50.0,30.0),
RS_Vector(0.5,0.5),
RS_Vector(-0.5,0.5),
RS_Vector(640,480),
"/home/andrew/data/image.png",
50, 50, 0);
image = new RS_Image(graphic, imageData);
image->setLayerToActive();
image->setPen(RS_Pen(RS_Color(255, 0, 0),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(image);
}
RS_DEBUG->print("%s\n: end\n", __func__);
}
示例4: getStatus
void QC_ActionGetPoint::mouseMoveEvent(QMouseEvent* e) {
RS_DEBUG->print("QC_ActionGetPoint::mouseMoveEvent begin");
if (getStatus()==SetReferencePoint ||
getStatus()==SetTargetPoint) {
RS_Vector mouse = snapPoint(e);
switch (getStatus()) {
case SetReferencePoint:
targetPoint = mouse;
break;
case SetTargetPoint:
if (referencePoint.valid) {
targetPoint = mouse;
deletePreview();
RS_Line *line =new RS_Line(preview,
RS_LineData(referencePoint, mouse));
line->setPen(RS_Pen(RS_Color(0,0,0), RS2::Width00, RS2::DotLine ));
preview->addEntity(line);
RS_DEBUG->print("QC_ActionGetPoint::mouseMoveEvent: draw preview");
drawPreview();
preview->addSelectionFrom(*container);
}
break;
default:
break;
}
}
RS_DEBUG->print("QC_ActionGetPoint::mouseMoveEvent end");
}
示例5: xorSnapper
/**
* Draws / deletes the current snapper spot.
*/
void RS_Snapper::xorSnapper() {
if (!finished && snapSpot.valid) {
RS_Painter* painter = graphicView->createDirectPainter();
painter->setPreviewMode();
if (snapCoord.valid) {
// snap point
painter->drawCircle(graphicView->toGui(snapCoord), 4);
// crosshairs:
if (showCrosshairs==true) {
painter->setPen(RS_Pen(RS_Color(0,255,255),
RS2::Width00, RS2::DashLine));
painter->drawLine(RS_Vector(0, graphicView->toGuiY(snapCoord.y)),
RS_Vector(graphicView->getWidth(),
graphicView->toGuiY(snapCoord.y)));
painter->drawLine(RS_Vector(graphicView->toGuiX(snapCoord.x),0),
RS_Vector(graphicView->toGuiX(snapCoord.x),
graphicView->getHeight()));
}
}
if (snapCoord.valid && snapCoord!=snapSpot) {
painter->drawLine(graphicView->toGui(snapSpot)+RS_Vector(-5,0),
graphicView->toGui(snapSpot)+RS_Vector(-1,4));
painter->drawLine(graphicView->toGui(snapSpot)+RS_Vector(0,5),
graphicView->toGui(snapSpot)+RS_Vector(4,1));
painter->drawLine(graphicView->toGui(snapSpot)+RS_Vector(5,0),
graphicView->toGui(snapSpot)+RS_Vector(1,-4));
painter->drawLine(graphicView->toGui(snapSpot)+RS_Vector(0,-5),
graphicView->toGui(snapSpot)+RS_Vector(-4,-1));
}
graphicView->destroyPainter();
visible = !visible;
}
}
示例6: RS_Line
/**
* Adds an entity to this preview and removes any attributes / layer
* connectsions before that.
*/
void RS_Preview::addEntity(RS_Entity* entity) {
if (entity==NULL || entity->isUndone()) {
return;
}
// only border preview for complex entities:
//if ((entity->count() > maxEntities-count()) &&
bool addBorder = false;
if (entity->rtti()==RS2::EntityImage || entity->rtti()==RS2::EntityHatch ||
entity->rtti()==RS2::EntityInsert) {
addBorder = true;
} else {
if (entity->isContainer() && entity->rtti()!=RS2::EntitySpline) {
if (entity->countDeep() > maxEntities-countDeep()) {
addBorder = true;
}
}
}
if (addBorder) {
RS_Vector min = entity->getMin();
RS_Vector max = entity->getMax();
RS_Line* l1 =
new RS_Line(this,
RS_LineData(RS_Vector(min.x, min.y),
RS_Vector(max.x, min.y)));
RS_Line* l2 =
new RS_Line(this,
RS_LineData(RS_Vector(max.x, min.y),
RS_Vector(max.x, max.y)));
RS_Line* l3 =
new RS_Line(this,
RS_LineData(RS_Vector(max.x, max.y),
RS_Vector(min.x, max.y)));
RS_Line* l4 =
new RS_Line(this,
RS_LineData(RS_Vector(min.x, max.y),
RS_Vector(min.x, min.y)));
RS_EntityContainer::addEntity(l1);
RS_EntityContainer::addEntity(l2);
RS_EntityContainer::addEntity(l3);
RS_EntityContainer::addEntity(l4);
delete entity;
entity = NULL;
} else {
entity->setLayer(NULL);
entity->setSelected(false);
entity->reparent(this);
entity->setPen(RS_Pen(RS_Color(255,255,255),
RS2::Width00,
RS2::SolidLine));
RS_EntityContainer::addEntity(entity);
}
}
示例7: removeEntity
/**
* Implementation of update. Updates the arrow.
*/
void RS_Leader::update() {
// find and delete arrow:
for(auto e: entities){
if (e->rtti()==RS2::EntitySolid) {
removeEntity(e);
break;
}
}
if (isUndone()) {
return;
}
RS_Entity* fe = firstEntity();
if (fe && fe->isAtomic()) {
RS_Vector p1 = ((RS_AtomicEntity*)fe)->getStartpoint();
RS_Vector p2 = ((RS_AtomicEntity*)fe)->getEndpoint();
// first entity must be the line which gets the arrow:
if (hasArrowHead()) {
RS_Solid* s = new RS_Solid(this, RS_SolidData());
s->shapeArrow(p1,
p2.angleTo(p1),
getGraphicVariableDouble("$DIMASZ", 2.5)* getGraphicVariableDouble("$DIMSCALE", 1.0));
s->setPen(RS_Pen(RS2::FlagInvalid));
s->setLayer(nullptr);
RS_EntityContainer::addEntity(s);
}
}
calculateBorders();
}
示例8: removeEntity
/**
* Implementation of update. Updates the arrow.
*/
void RS_Leader::update() {
// find and delete arrow:
for (RS_Entity* e=firstEntity(); e!=NULL; e=nextEntity()) {
if (e->rtti()==RS2::EntitySolid) {
removeEntity(e);
break;
}
}
if (isUndone()) {
setVisible(false);
return;
}
RS_Entity* fe = firstEntity();
if (fe!=NULL && fe->isAtomic()) {
RS_Vector p1 = ((RS_AtomicEntity*)fe)->getStartpoint();
RS_Vector p2 = ((RS_AtomicEntity*)fe)->getEndpoint();
// first entity must be the line which gets the arrow:
if (hasArrowHead()) {
RS_Solid* s = new RS_Solid(this, RS_SolidData());
s->shapeArrow(p1,
p2.angleTo(p1),
getGraphicVariableDouble("$DIMASZ", 2.5));
s->setPen(RS_Pen(RS2::FlagInvalid));
s->setLayer(NULL);
RS_EntityContainer::addEntity(s);
}
}
}
示例9: printf
/**
* Testing function.
*/
void LC_SimpleTests::slotTestUnicode() {
RS_DEBUG->print("%s\n: begin\n", __func__);
auto appWin= QC_ApplicationWindow::getAppWindow();
appWin->slotFileOpen("./fonts/unicode.cxf", RS2::FormatCXF);
RS_Document* d =appWin->getDocument();
if (d) {
RS_Graphic* graphic = (RS_Graphic*)d;
if (graphic==NULL) {
return;
}
RS_Insert* ins;
int col;
int row;
QChar uCode; // e.g. 65 (or 'A')
QString strCode; // unicde as string e.g. '[0041] A'
graphic->setAutoUpdateBorders(false);
for (col=0x0000; col<=0xFFF0; col+=0x10) {
printf("col: %X\n", col);
for (row=0x0; row<=0xF; row++) {
//printf(" row: %X\n", row);
uCode = QChar(col+row);
//printf(" code: %X\n", uCode.unicode());
strCode.setNum(uCode.unicode(), 16);
while (strCode.length()<4) {
strCode="0"+strCode;
}
strCode = "[" + strCode + "] " + uCode;
if (graphic->findBlock(strCode)) {
RS_InsertData d(strCode,
RS_Vector(col/0x10*20.0,row*20.0),
RS_Vector(1.0,1.0), 0.0,
1, 1, RS_Vector(0.0, 0.0),
NULL, RS2::NoUpdate);
ins = new RS_Insert(graphic, d);
ins->setLayerToActive();
ins->setPen(RS_Pen(RS_Color(255, 255, 255),
RS2::Width01,
RS2::SolidLine));
ins->update();
graphic->addEntity(ins);
}
}
}
graphic->setAutoUpdateBorders(true);
graphic->calculateBorders();
}
RS_DEBUG->print("%s\n: end\n", __func__);
}
示例10: RS_EntityContainer
/**
* Constructor.
*
* @param parent Parent of the document. Often that's NULL but
* for blocks it's the blocklist.
*/
RS_Document::RS_Document(RS_EntityContainer* parent)
: RS_EntityContainer(parent), RS_Undo() {
RS_DEBUG->print("RS_Document::RS_Document() ");
filename = "";
formatType = RS2::FormatUnknown;
setModified(false);
RS_Color col(RS2::FlagByLayer);
activePen = RS_Pen(col, RS2::WidthByLayer, RS2::LineByLayer);
}
示例11: ArraySize
void DL_Jww::CreateTen(DL_CreationInterface* creationInterface, CDataTen& DTen)
{
string lName = HEX[DTen.m_nGLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DTen.m_nGLayer] + "-" +
HEX[DTen.m_nLayer > ArraySize(HEX)-1 ? ArraySize(HEX)-1: DTen.m_nLayer];
// add layer
creationInterface->addLayer(DL_LayerData(lName,0));
int width;
if(DTen.m_nPenWidth > 26)
width = 0;
else
width = DTen.m_nPenWidth;
int color = colTable[DTen.m_nPenColor > ArraySize(colTable)-1 ? ArraySize(colTable)-1 : DTen.m_nPenColor];
attrib = DL_Attributes(values[8], // layer
color, // color
width, // width
lTable[DTen.m_nPenStyle > ArraySize(lTable)-1 ? ArraySize(lTable)-1 : DTen.m_nPenStyle]); // linetype
creationInterface->setAttributes(attrib);
creationInterface->setExtrusion(0.0, 0.0, 1.0, 0.0 );
DL_PointData d(DTen.m_start.x, DTen.m_start.y, 0.0);
creationInterface->addPoint(d);
#ifdef FINISHED
RS_PointData data2(RS_Vector(0.0, 0.0));
RS_Point* point;
data2.pos = RS_Vector(DTen.m_start.x, DTen.m_start.y);
point = new RS_Point(graphic, data2);
RS2::LineType ltype = lTable[DTen.m_nPenStyle];
RS_Color col = colTable[DTen.m_nPenColor];
RS2::LineWidth lw = lWidth[DTen.m_nPenWidth > 26 ? 0 :DTen.m_nPenWidth];//RS2::Width12
point->setPen(RS_Pen(col, RS2::Width23, ltype));
//画層設定
RS_String lName = HEX[DTen.m_nGLayer > 0x0f ? 0 : DTen.m_nGLayer] + "-" +
HEX[DTen.m_nLayer > 0x0f ? 0: DTen.m_nLayer];
if( graphic->findLayer(lName) == (RS_Layer*)NULL ){
#ifdef DEBUG
std::cout << lName.ascii() << std::endl;
#endif
RS_Layer* layer = new RS_Layer(lName);
graphic->addLayer(layer);
}
point->setLayer(lName);
// add the line to the graphic
graphic->addEntity(point);
#ifdef DEBUG
std::cout << *point;
#endif
#endif
}
示例12: snapPoint
void QC_ActionGetPoint::mouseMoveEvent(QMouseEvent* e) {
RS_DEBUG->print("QC_ActionGetPoint::mouseMoveEvent begin");
RS_Vector mouse = snapPoint(e);
if(setTargetPoint){
if (referencePoint.valid) {
targetPoint = mouse;
deletePreview();
RS_Line *line =new RS_Line(preview,
RS_LineData(referencePoint, mouse));
line->setPen(RS_Pen(RS_Color(0,0,0), RS2::Width00, RS2::DotLine ));
preview->addEntity(line);
RS_DEBUG->print("QC_ActionGetPoint::mouseMoveEvent: draw preview");
drawPreview();
preview->addSelectionFrom(*container);
}
} else {
targetPoint = mouse;
}
RS_DEBUG->print("QC_ActionGetPoint::mouseMoveEvent end");
}
示例13: RS_Pen
void QG_GraphicView::layerActivated(RS_Layer *layer) {
RS_SETTINGS->beginGroup("/Modify");
bool toActivated= (RS_SETTINGS->readNumEntry("/ModifyEntitiesToActiveLayer", 0)==1);
RS_SETTINGS->endGroup();
if(!toActivated) return;
RS_EntityContainer *container = this->getContainer();
//allow undo cycle for layer change of selected
RS_AttributesData data;
data.pen = RS_Pen();
data.layer = layer->getName();
data.changeColor = false;
data.changeLineType = false;
data.changeWidth = false;
data.changeLayer = true;
RS_Modification m(*container, this);
m.changeAttributes(data);
container->setSelected(false);
redraw(RS2::RedrawDrawing);
}
示例14: RS_Vector
/**
* Adds a vertex from the endpoint of the last element or
* sets the startpoint to the point 'v'.
*
* The very first vertex added is the starting point.
*
* @param v vertex coordinate
*
* @return Pointer to the entity that was addded or NULL if this
* was the first vertex added.
*/
RS_Entity* RS_Leader::addVertex(const RS_Vector& v) {
RS_Entity* entity=NULL;
static RS_Vector last = RS_Vector(false);
if (empty) {
last = v;
empty = false;
} else {
// add line to the leader:
entity = new RS_Line(this, RS_LineData(last, v));
entity->setPen(RS_Pen(RS2::FlagInvalid));
entity->setLayer(NULL);
RS_EntityContainer::addEntity(entity);
if (count()==1 && hasArrowHead()) {
update();
}
last = v;
}
return entity;
}
示例15: addVertex
/**
* Adds a vertex from the endpoint of the last element or
* sets the startpoint to the point 'v'.
*
* The very first vertex added is the starting point.
*
* @param v vertex coordinate
*
* @return Pointer to the entity that was added or nullptr if this
* was the first vertex added.
*/
RS_Entity* RS_Leader::addVertex(const RS_Vector& v) {
RS_Entity* entity{nullptr};
static RS_Vector last = RS_Vector{false};
if (empty) {
last = v;
empty = false;
} else {
// add line to the leader:
entity = new RS_Line{this, {last, v}};
entity->setPen(RS_Pen(RS2::FlagInvalid));
entity->setLayer(nullptr);
RS_EntityContainer::addEntity(entity);
if (count()==1 && hasArrowHead()) {
update();
}
last = v;
}
return entity;
}