本文整理汇总了C++中app::Color::asCSSString方法的典型用法代码示例。如果您正苦于以下问题:C++ Color::asCSSString方法的具体用法?C++ Color::asCSSString怎么用?C++ Color::asCSSString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app::Color
的用法示例。
在下文中一共展示了Color::asCSSString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawViewPart
void QGIViewPart::drawViewPart()
{
auto viewPart( dynamic_cast<TechDraw::DrawViewPart *>(getViewObject()) );
if ( viewPart == nullptr ) {
return;
}
float lineWidth = viewPart->LineWidth.getValue() * lineScaleFactor;
float lineWidthHid = viewPart->HiddenWidth.getValue() * lineScaleFactor;
float lineWidthIso = viewPart->IsoWidth.getValue() * lineScaleFactor;
prepareGeometryChange();
removePrimitives(); //clean the slate
removeDecorations();
#if MOD_TECHDRAW_HANDLE_FACES
if (viewPart->handleFaces()) {
// Draw Faces
std::vector<TechDraw::DrawHatch*> hatchObjs = viewPart->getHatches();
const std::vector<TechDrawGeometry::Face *> &faceGeoms = viewPart->getFaceGeometry();
std::vector<TechDrawGeometry::Face *>::const_iterator fit = faceGeoms.begin();
for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) {
QGIFace* newFace = drawFace(*fit,i);
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
if (fHatch) {
if (!fHatch->HatchPattern.isEmpty()) {
App::Color hColor = fHatch->HatchColor.getValue();
newFace->setHatchColor(hColor.asCSSString());
newFace->setHatch(fHatch->HatchPattern.getValue());
}
}
newFace->setDrawEdges(false);
newFace->setZValue(ZVALUE::FACE);
newFace->setPrettyNormal();
}
}
#endif //#if MOD_TECHDRAW_HANDLE_FACES
// Draw Edges
const std::vector<TechDrawGeometry::BaseGeom *> &geoms = viewPart->getEdgeGeometry();
std::vector<TechDrawGeometry::BaseGeom *>::const_iterator itEdge = geoms.begin();
QGIEdge* item;
for(int i = 0 ; itEdge != geoms.end(); itEdge++, i++) {
bool showEdge = false;
if ((*itEdge)->visible) {
if (((*itEdge)->classOfEdge == ecHARD) ||
((*itEdge)->classOfEdge == ecOUTLINE) ||
(((*itEdge)->classOfEdge == ecSMOOTH) && viewPart->SmoothVisible.getValue()) ||
(((*itEdge)->classOfEdge == ecSEAM) && viewPart->SeamVisible.getValue()) ||
(((*itEdge)->classOfEdge == ecUVISO) && viewPart->IsoVisible.getValue())) {
showEdge = true;
}
} else {
if ( (((*itEdge)->classOfEdge == ecHARD) && (viewPart->HardHidden.getValue())) ||
(((*itEdge)->classOfEdge == ecOUTLINE) && (viewPart->HardHidden.getValue())) ||
(((*itEdge)->classOfEdge == ecSMOOTH) && (viewPart->SmoothHidden.getValue())) ||
(((*itEdge)->classOfEdge == ecSEAM) && (viewPart->SeamHidden.getValue())) ||
(((*itEdge)->classOfEdge == ecUVISO) && (viewPart->IsoHidden.getValue())) ) {
showEdge = true;
}
}
if (showEdge) {
item = new QGIEdge(i);
addToGroup(item); //item is at scene(0,0), not group(0,0)
item->setPos(0.0,0.0); //now at group(0,0)
item->setPath(drawPainterPath(*itEdge));
item->setWidth(lineWidth);
item->setZValue(ZVALUE::EDGE);
if(!(*itEdge)->visible) {
item->setWidth(lineWidthHid);
item->setHiddenEdge(true);
item->setZValue(ZVALUE::HIDEDGE);
}
if ((*itEdge)->classOfEdge == ecUVISO) {
item->setWidth(lineWidthIso);
}
item->setPrettyNormal();
//debug a path
//QPainterPath edgePath=drawPainterPath(*itEdge);
//std::stringstream edgeId;
//edgeId << "QGIVP.edgePath" << i;
//dumpPath(edgeId.str().c_str(),edgePath);
}
}
// Draw Vertexs:
const std::vector<TechDrawGeometry::Vertex *> &verts = viewPart->getVertexGeometry();
std::vector<TechDrawGeometry::Vertex *>::const_iterator vert = verts.begin();
bool showCenters = viewPart->ArcCenterMarks.getValue();
double cAdjust = viewPart->CenterScale.getValue();
for(int i = 0 ; vert != verts.end(); ++vert, i++) {
if ((*vert)->isCenter) {
if (showCenters) {
QGICMark* cmItem = new QGICMark(i);
addToGroup(cmItem);
cmItem->setPos((*vert)->pnt.fX, (*vert)->pnt.fY); //this is in ViewPart coords
cmItem->setThick(0.5 * lineWidth * lineScaleFactor); //need minimum?
cmItem->setSize( cAdjust * lineWidth * vertexScaleFactor);
cmItem->setZValue(ZVALUE::VERTEX);
}
//.........这里部分代码省略.........
示例2: getSheetImage
std::string DrawViewSpreadsheet::getSheetImage(void)
{
std::stringstream result;
App::DocumentObject* link = Source.getValue();
std::string scellstart = CellStart.getValue();
std::string scellend = CellEnd.getValue();
std::vector<std::string> availcolumns = getAvailColumns();
// build rows range and columns range
std::vector<std::string> columns;
std::vector<int> rows;
try {
for (unsigned int i=0; i<scellstart.length(); ++i) {
if (isdigit(scellstart[i])) {
columns.push_back(scellstart.substr(0,i));
rows.push_back(std::atoi(scellstart.substr(i,scellstart.length()-1).c_str()));
}
}
for (unsigned int i=0; i<scellend.length(); ++i) {
if (isdigit(scellend[i])) {
std::string startcol = columns.back();
std::string endcol = scellend.substr(0,i);
bool valid = false;
for (std::vector<std::string>::const_iterator j = availcolumns.begin(); j != availcolumns.end(); ++j) {
if ( (*j) == startcol) {
if ( (*j) != endcol) {
valid = true;
}
} else {
if (valid) {
if ( (*j) == endcol) {
columns.push_back((*j));
valid = false;
} else {
columns.push_back((*j));
}
}
}
}
int endrow = std::atoi(scellend.substr(i,scellend.length()-1).c_str());
for (int j=rows.back()+1; j<=endrow; ++j) {
rows.push_back(j);
}
}
}
} catch (std::exception) {
Base::Console().Error("Invalid cell range for %s\n",getNameInDocument());
return result.str();
}
// create the containing group
std::string ViewName = Label.getValue();
result << getSVGHead();
App::Color c = TextColor.getValue();
result << "<g id=\"" << ViewName << "\">" << endl;
// fill the cells
float rowoffset = 0.0;
float coloffset = 0.0;
float cellheight = 100;
float cellwidth = 100;
std::string celltext;
Spreadsheet::Sheet* sheet = static_cast<Spreadsheet::Sheet*>(link);
std::vector<std::string> skiplist;
for (std::vector<std::string>::const_iterator col = columns.begin(); col != columns.end(); ++col) {
// create a group for each column
result << " <g id=\"" << ViewName << "_col" << (*col) << "\">" << endl;
for (std::vector<int>::const_iterator row = rows.begin(); row != rows.end(); ++row) {
// get cell size
std::stringstream srow;
srow << (*row);
App::CellAddress address((*col) + srow.str());
cellwidth = sheet->getColumnWidth(address.col());
cellheight = sheet->getRowHeight(address.row());
celltext = "";
// get the text
App::Property* prop = sheet->getPropertyByName(address.toString().c_str());
std::stringstream field;
if (prop != 0) {
if (prop->isDerivedFrom((App::PropertyQuantity::getClassTypeId())))
field << static_cast<App::PropertyQuantity*>(prop)->getValue();
else if (prop->isDerivedFrom((App::PropertyFloat::getClassTypeId())))
field << static_cast<App::PropertyFloat*>(prop)->getValue();
else if (prop->isDerivedFrom((App::PropertyString::getClassTypeId())))
field << static_cast<App::PropertyString*>(prop)->getValue();
else
assert(0);
celltext = field.str();
}
// get colors, style, alignment and span
int alignment;
std::string bcolor = "none";
std::string fcolor = c.asCSSString();
std::string textstyle = "";
Spreadsheet::Cell* cell = sheet->getCell(address);
if (cell) {
//.........这里部分代码省略.........
示例3: drawViewPart
void QGIViewPart::drawViewPart()
{
if ( getViewObject() == 0 ||
!getViewObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) {
return;
}
TechDraw::DrawViewPart *viewPart = dynamic_cast<TechDraw::DrawViewPart *>(getViewObject());
float lineWidth = viewPart->LineWidth.getValue() * lineScaleFactor;
float lineWidthHid = viewPart->HiddenWidth.getValue() * lineScaleFactor;
prepareGeometryChange();
#if MOD_TECHDRAW_HANDLE_FACES
// Draw Faces
std::vector<TechDraw::DrawHatch*> hatchObjs = viewPart->getHatches();
const std::vector<TechDrawGeometry::Face *> &faceGeoms = viewPart->getFaceGeometry();
std::vector<TechDrawGeometry::Face *>::const_iterator fit = faceGeoms.begin();
for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) {
QGIFace* newFace = drawFace(*fit,i);
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
if (fHatch) {
if (!fHatch->HatchPattern.isEmpty()) {
App::Color hColor = fHatch->HatchColor.getValue();
newFace->setHatchColor(hColor.asCSSString());
newFace->setHatch(fHatch->HatchPattern.getValue());
}
}
newFace->setZValue(ZVALUE::FACE);
newFace->setPrettyNormal();
}
#endif //#if MOD_TECHDRAW_HANDLE_FACES
// Draw Edges
const std::vector<TechDrawGeometry::BaseGeom *> &geoms = viewPart->getEdgeGeometry();
std::vector<TechDrawGeometry::BaseGeom *>::const_iterator itEdge = geoms.begin();
QGIEdge* item;
for(int i = 0 ; itEdge != geoms.end(); itEdge++, i++) {
bool showEdge = false;
if ((*itEdge)->visible) {
if (((*itEdge)->classOfEdge == ecHARD) ||
((*itEdge)->classOfEdge == ecOUTLINE) ||
(((*itEdge)->classOfEdge == ecSMOOTH) && viewPart->ShowSmoothLines.getValue()) ||
(((*itEdge)->classOfEdge == ecSEAM) && viewPart->ShowSeamLines.getValue())) {
showEdge = true;
}
} else {
if (viewPart->ShowHiddenLines.getValue()) {
showEdge = true;
}
}
if (showEdge) {
item = new QGIEdge(i);
addToGroup(item); //item is at scene(0,0), not group(0,0)
item->setPos(0.0,0.0);
item->setPath(drawPainterPath(*itEdge));
item->setStrokeWidth(lineWidth);
item->setZValue(ZVALUE::EDGE);
if(!(*itEdge)->visible) {
item->setStrokeWidth(lineWidthHid);
item->setHiddenEdge(true);
item->setZValue(ZVALUE::HIDEDGE);
}
item->setPrettyNormal();
//debug a path
//QPainterPath edgePath=drawPainterPath(*itEdge);
//std::stringstream edgeId;
//edgeId << "QGIVP.edgePath" << i;
//dumpPath(edgeId.str().c_str(),edgePath);
}
}
// Draw Vertexs:
const std::vector<TechDrawGeometry::Vertex *> &verts = viewPart->getVertexGeometry();
std::vector<TechDrawGeometry::Vertex *>::const_iterator vert = verts.begin();
for(int i = 0 ; vert != verts.end(); ++vert, i++) {
QGIVertex *item = new QGIVertex(i);
addToGroup(item);
item->setPos((*vert)->pnt.fX, (*vert)->pnt.fY); //this is in ViewPart coords
item->setRadius(lineWidth * vertexScaleFactor);
item->setZValue(ZVALUE::VERTEX);
}
}