void LineItem::renderEditor(F32 currentScale, bool snappingToWallCornersEnabled, bool renderVertices) const { #ifndef ZAP_DEDICATED if(isSelected() || isLitUp()) RenderUtils::drawLine(getOutline(), EditorUserInterface::getColor(isSelected(), isLitUp())); else RenderUtils::drawLine(getOutline(), getEditorRenderColor()); if(renderVertices) GameObjectRender::renderPolyLineVertices(this, snappingToWallCornersEnabled, currentScale); #endif }
void PolygonObject::renderPolyHighlight() const { #ifndef ZAP_DEDICATED const Color &color = isSelected() ? Colors::EDITOR_SELECT_COLOR : Colors::EDITOR_HIGHLIGHT_COLOR; GameObjectRender::renderPolygonOutline(getOutline(), color, 1, RenderUtils::LINE_WIDTH_3); #endif }
QPainterPath BI_Via::toQPainterPathPx(const Length& expansion) const noexcept { QPainterPath p = getOutline(expansion).toQPainterPathPx(); p.setFillRule(Qt::OddEvenFill); // important to subtract the hole! p.addEllipse(QPointF(0, 0), mDrillDiameter->toPx() / 2, mDrillDiameter->toPx() / 2); return p; }
bool MatrixOutline::isSizeOK(int m, int n) const { SimTK_ASSERT2(m>=0 && n>=0, "MatrixOutline::isSizeOK(): sizes must be non-negative; got %dx%d", m, n); switch(getOutline()) { case Scalar: return m==1 && n==1; case Column: return n==1; case Row: return m==1; case Square: return m==n; case Wide: return m<=n; case Tall: return m>=n; case Rectangular: return true; default: SimTK_ASSERT1_ALWAYS(!"invalid MatrixOutline::Outline", "MatrixOutline::isSizeOK(): value 0x%x is invalid.", getOutline()); return false; }; }
void NexusZone::render() const { #ifndef ZAP_DEDICATED GameType *gameType = getGame() ? getGame()->getGameType() : NULL; NexusGameType *nexusGameType = NULL; if(gameType && gameType->getGameTypeId() == NexusGame) nexusGameType = static_cast<NexusGameType *>(gameType); bool isOpen = nexusGameType && nexusGameType->isNexusOpen(); F32 glowFraction = gameType ? gameType->mZoneGlowTimer.getFraction() : 0; GameObjectRender::renderNexus(getOutline(), getFill(), getCentroid(), getLabelAngle(), isOpen, glowFraction); #endif }
void Map::draw(sf::RenderTarget & target, sf::RenderStates states) const { if (_hasChanged) { _bools = getBoolMap(); _mapOutline = getOutline(); _hasChanged = false; } target.draw(_mapOutline, states); if (_flashActif) { if (_clockFlash.getElapsedTime().asMilliseconds() < _dureeFlash) target.draw(_texteFlash); else if (_clockFlash.getElapsedTime().asMilliseconds() > _frequenceFlash) _clockFlash.restart(); } }
void Map::lireMap(std::istream & map) { if (!_map.empty()) _map.clear(); auto linePos = readNumFromStream<float, false>(map, 0, "(, )\n", '.'); if (linePos.size() % 4) throw std::invalid_argument("Le format de la map est invalide!"); for (int i = 0; i < linePos.size(); i += 4) { ajouterLigne(Ligne(linePos[i], linePos[i + 1], linePos[i + 2], linePos[i + 3])); } _bools = getBoolMap(); _mapOutline = getOutline(); }
QList<RBox> RPolylineData::getBoundingBoxes(bool ignoreEmpty) const { Q_UNUSED(ignoreEmpty) QList<RBox> ret; if (hasWidths()) { QList<RPolyline> outline = getOutline(); for (int i=0; i<outline.length(); i++) { Q_ASSERT(!outline[i].hasWidths()); ret.append(outline[i].getBoundingBox()); } return ret; } QList<QSharedPointer<RShape> > shapes = getExploded(); for (int i=0; i<shapes.size(); i++) { ret.append(shapes.at(i)->getBoundingBox()); } return ret; }
//---------------------------------------------------------- void ofPath::draw(){ if(ofGetCurrentRenderer()->rendersPathPrimitives()){ ofGetCurrentRenderer()->draw(*this); }else{ tessellate(); ofColor prevColor; if(bUseShapeColor){ prevColor = ofGetStyle().color; } if(bFill){ if(bUseShapeColor){ ofSetColor(fillColor); } ofGetCurrentRenderer()->draw(cachedTessellation,bUseShapeColor,false,false); } if(hasOutline()){ float lineWidth = ofGetStyle().lineWidth; if(bUseShapeColor){ ofSetColor(strokeColor); } ofSetLineWidth( strokeWidth ); vector<ofPolyline> & polys = getOutline(); for(int i=0;i<(int)polys.size();i++){ ofGetCurrentRenderer()->draw(polys[i]); } ofSetLineWidth(lineWidth); } if(bUseShapeColor){ ofSetColor(prevColor); } } }
const Vector<Point> *NexusZone::getCollisionPoly() const { return getOutline(); }
void NexusZone::renderDock(const Color &color) const { #ifndef ZAP_DEDICATED GameObjectRender::renderNexus(getOutline(), getFill(), false, 0); #endif }
void LineItem::render() const { #ifndef ZAP_DEDICATED RenderUtils::drawLine(getOutline(), getColor()); #endif }
char VecFile::read() { // File open for reading? isOpenR(); // Read the current line fstream_.getline(inBuf_, s_vec_line_size_); // End of file? if (fstream_.eof()) { eof_flag_ = true; return EOF ; } // Store current line into a string stream std::istringstream iss(std::string((const char*)inBuf_), std::istringstream::in); // Get primitive type iss >> lastPrimitive_; switch (lastPrimitive_) { // *************************************************************** // S E G M E N T // *************************************************************** case s_vec_prim_segment_: getOutline(iss); // outline iss >> x1_ // X source >> y1_ // Y source >> x2_ // X target >> y2_ // Y target >> thickness_; // thickness break; // *************************************************************** // C I R C L E // *************************************************************** case s_vec_prim_circle_: getOutline(iss); // outline iss >> x1_ // X center >> y1_ // Y center >> radius_ // radius >> thickness_; // thickness break; // *************************************************************** // A R C O F C I R C L E // *************************************************************** case s_vec_prim_arc_: getOutline(iss); // outline iss >> x1_ // X center >> y1_ // Y center >> radius_ // radius >> startAngleDegrees_ // source angle >> endAngleDegrees_ // target angle >> thickness_; // thickness break; // *************************************************************** // T E X T U A L R E G I O N // *************************************************************** case s_vec_prim_text_: iss >> x1_ // X coordinate of insertion point >> y1_ // Y coordinate of insertion point >> x2_ // X coordinate of opposite point >> y2_ // Y coordinate of opposite point >> orientationDegrees_ // base line angle >> fontHeight_ // font height >> fontWidthFactor_ // font width factor >> fontStrokeWidth_; // font stroke width // Skip space characters char c; do { c = iss.get(); } while (c == ' '); // Text string must be a introduced as a comment if (c != s_vec_comment_) { std::ostringstream os; os << "Bad text string in file " << name_ << ": " << " should be introduced by " << s_vec_comment_; throw QgarErrorIO(__FILE__, __LINE__, "void qgar::VecFile::read()", os.str()); } // Read text string iss >> text_; break; // *************************************************************** // E R R O R : U N K N O W N P R I M I T I V E T Y P E // *************************************************************** default: std::ostringstream os; os << "Unknown primitive in file " << name_ << ": " << lastPrimitive_; throw QgarErrorIO(__FILE__, __LINE__, "void qgar::VecFile::read()", os.str()); // *************************************************************** } // END switch // End of line? if (!iss.eof()) { std::ostringstream os; os << "Junk in file " << name_ << ": " << inBuf_; throw QgarErrorIO(__FILE__, __LINE__, "void qgar::VecFile::read()", os.str()); } // Return primitive type return lastPrimitive_; }
Path BI_Via::getSceneOutline(const Length& expansion) const noexcept { return getOutline(expansion).translated(mPosition); }
Path BI_FootprintPad::getSceneOutline(const Length& expansion) const noexcept { return getOutline(expansion).rotated(mRotation).translated(mPosition); }