void DisplayList::replaceDisplayObject(DisplayObject* ch, int depth, bool use_old_cxform, bool use_old_matrix) { testInvariant(); //GNASH_REPORT_FUNCTION; assert(!ch->unloaded()); ch->set_invalidated(); ch->set_depth(depth); container_type::iterator it = std::find_if(_charsByDepth.begin(), _charsByDepth.end(), boost::bind(std::not2(DepthLessThan()), _1, depth)); if (it == _charsByDepth.end() || (*it)->get_depth() != depth) { _charsByDepth.insert(it, ch); } else { // Make a copy (before replacing) DisplayObject* oldch = *it; InvalidatedRanges old_ranges; if (use_old_cxform) { // Use the SWFCxForm from the old DisplayObject. ch->setCxForm(getCxForm(*oldch)); } if (use_old_matrix) { // Use the SWFMatrix from the old DisplayObject. ch->setMatrix(getMatrix(*oldch), true); } // remember bounds of old char oldch->add_invalidated_bounds(old_ranges, true); // replace existing char (before calling unload) *it = ch; // Unload old char if (oldch->unload()) { // reinsert removed DisplayObject if needed reinsertRemovedCharacter(oldch); } else oldch->destroy(); // extend invalidated bounds // WARNING: when a new Button DisplayObject is added, // the invalidated bounds computation will likely // be bogus, as the actual DisplayObject shown is not // instantiated until stagePlacementCallback for buttons // (I'd say this is a bug in Button). ch->extend_invalidated_bounds(old_ranges); } testInvariant(); }
/*public*/ void EdgeRing::computeRing() { testInvariant(); if (ring!=NULL) return; // don't compute more than once ring=geometryFactory->createLinearRing(pts); isHoleVar=CGAlgorithms::isCCW(pts); testInvariant(); }
/*public*/ EdgeEndStar * Node::getEdges() { testInvariant(); return edges; }
/*public*/ void Node::mergeLabel(const Node& n) { assert(n.label); mergeLabel(*(n.label)); testInvariant(); }
/*public*/ bool EdgeRing::containsPoint(const Coordinate& p) { testInvariant(); assert(ring); const Envelope* env=ring->getEnvelopeInternal(); assert(env); if ( ! env->contains(p) ) return false; if ( ! CGAlgorithms::isPointInRing(p, ring->getCoordinatesRO()) ) return false; for (vector<EdgeRing*>::iterator i=holes.begin(); i<holes.end(); ++i) { EdgeRing *hole=*i; assert(hole); if (hole->containsPoint(p)) { return false; } } return true; }
/*public*/ Node::Node(const Coordinate& newCoord, EdgeEndStar* newEdges) : GraphComponent(Label(0,Location::UNDEF)), coord(newCoord), edges(newEdges) { #if GEOS_DEBUG cerr<<"["<<this<<"] Node::Node("<<newCoord.toString()<<")"<<endl; #endif #if COMPUTE_Z ztot = 0; addZ(newCoord.z); if ( edges ) { EdgeEndStar::iterator endIt = edges->end(); for (EdgeEndStar::iterator it=edges->begin(); it!=endIt; ++it) { EdgeEnd *ee = *it; addZ(ee->getCoordinate().z); } } #endif // COMPUTE_Z testInvariant(); }
LinearRing* EdgeRing::getLinearRing() { testInvariant(); // return new LinearRing(*ring); return ring; }
/*public*/ bool Node::isIsolated() const { testInvariant(); return (label.getGeometryCount()==1); }
/*public*/ void Node::mergeLabel(const Node& n) { assert(!n.label.isNull()); mergeLabel(n.label); testInvariant(); }
void Node::add(EdgeEnd *e) { assert(e); #if GEOS_DEBUG cerr<<"["<<this<<"] Node::add("<<e->print()<<")"<<endl; #endif // Assert: start pt of e is equal to node point if ( ! e->getCoordinate().equals2D(coord) ) { std::stringstream ss; ss << "EdgeEnd with coordinate " << e->getCoordinate() << " invalid for node " << coord; throw util::IllegalArgumentException(ss.str()); } // It seems it's legal for edges to be NULL // we'd not be honouring the promise of adding // an EdgeEnd in this case, though ... assert(edges); //if (edges==NULL) return; edges->insert(e); e->setNode(this); #if COMPUTE_Z addZ(e->getCoordinate().z); #endif testInvariant(); }
/*protected*/ void EdgeRing::computePoints(DirectedEdge *newStart) // throw(const TopologyException &) { startDe=newStart; DirectedEdge *de=newStart; bool isFirstEdge=true; do { //util::Assert::isTrue(de!=NULL,"EdgeRing::computePoints: found null Directed Edge"); //assert(de!=NULL); // EdgeRing::computePoints: found null Directed Edge if(de==NULL) throw util::TopologyException( "EdgeRing::computePoints: found null Directed Edge"); if (de->getEdgeRing()==this) throw util::TopologyException( "Directed Edge visited twice during ring-building", de->getCoordinate()); edges.push_back(de); const Label& deLabel = de->getLabel(); assert(deLabel.isArea()); mergeLabel(deLabel); addPoints(de->getEdge(),de->isForward(),isFirstEdge); isFirstEdge=false; setEdgeRing(de,this); de=getNext(de); } while (de!=startDe); testInvariant(); }
/*public*/ vector<DirectedEdge*>& EdgeRing::getEdges() { testInvariant(); return edges; }
void EdgeRing::setShell(EdgeRing *newShell) { shell=newShell; if (shell!=NULL) shell->addHole(this); testInvariant(); }
EdgeRing::~EdgeRing() { testInvariant(); /* * If we constructed a ring, we did by transferring * ownership of the CoordinateSequence, so it will be * destroyed by `ring' dtor and we must not destroy * it twice. */ if ( ring == NULL ) { delete pts; } else { delete ring; } for(size_t i=0, n=holes.size(); i<n; ++i) { delete holes[i]; } #if GEOS_DEBUG cerr << "EdgeRing[" << this << "] dtor" << endl; #endif }
EdgeRing::EdgeRing(DirectedEdge *newStart, const GeometryFactory *newGeometryFactory) : startDe(newStart), geometryFactory(newGeometryFactory), holes(), maxNodeDegree(-1), edges(), pts(newGeometryFactory->getCoordinateSequenceFactory()->create(NULL)), label(Location::UNDEF), // new Label(Location::UNDEF)), ring(NULL), isHoleVar(false), shell(NULL) { /* * Commented out to fix different polymorphism in C++ (from Java) * Make sure these calls are made by derived classes ! */ //computePoints(start); //computeRing(); #if GEOS_DEBUG cerr << "EdgeRing[" << this << "] ctor" << endl; #endif testInvariant(); }
/*public*/ Node::~Node() { testInvariant(); #if GEOS_DEBUG cerr<<"["<<this<<"] Node::~Node()"<<endl; #endif delete edges; }
/*public*/ int EdgeRing::getMaxNodeDegree() { testInvariant(); if (maxNodeDegree<0) computeMaxNodeDegree(); return maxNodeDegree; }
/*public*/ string Node::print() { testInvariant(); ostringstream ss; ss<<*this; return ss.str(); }
/*protected*/ void EdgeRing::mergeLabel(const Label& deLabel) { mergeLabel(deLabel, 0); mergeLabel(deLabel, 1); testInvariant(); }
/*public*/ void Node::mergeLabel(const Label& label2) { for (int i=0; i<2; i++) { int loc=computeMergedLocation(label2, i); int thisLoc=label.getLocation(i); if (thisLoc==Location::UNDEF) label.setLocation(i,loc); } testInvariant(); }
/*public*/ void Node::setLabel(int argIndex, int onLocation) { if ( label.isNull() ) { label = Label(argIndex, onLocation); } else label.setLocation(argIndex, onLocation); testInvariant(); }
/*public*/ void Node::setLabel(int argIndex, int onLocation) { if (label==NULL) { label=new Label(argIndex, onLocation); } else label->setLocation(argIndex, onLocation); testInvariant(); }
/*public*/ void EdgeRing::setInResult() { DirectedEdge *de=startDe; do { de->getEdge()->setInResult(true); de=de->getNext(); } while (de!=startDe); testInvariant(); }
bool EdgeRing::isHole() { testInvariant(); // We can't tell if this is an hole // unless we computed the ring // see computeRing() assert(ring); return isHoleVar; }
// Updates the transform properties of the DisplayObject at // the specified depth. void DisplayList::moveDisplayObject(int depth, const SWFCxForm* color_xform, const SWFMatrix* mat, boost::uint16_t* ratio) { testInvariant(); DisplayObject* ch = getDisplayObjectAtDepth(depth); if (! ch) { // FIXME, should this be log_aserror? IF_VERBOSE_MALFORMED_SWF( log_swferror(_("moveDisplayObject() -- can't find object at depth %d"), depth); );
/*public*/ int Node::computeMergedLocation(const Label& label2, int eltIndex) { int loc=Location::UNDEF; loc=label.getLocation(eltIndex); if (!label2.isNull(eltIndex)) { int nLoc=label2.getLocation(eltIndex); if (loc!=Location::BOUNDARY) loc=nLoc; } testInvariant(); return loc; }
DisplayObject* DisplayList::getDisplayObjectByName_i(const std::string& name) { testInvariant(); const container_type::iterator e = _charsByDepth.end(); container_type::const_iterator it = std::find_if( _charsByDepth.begin(), e, NameEqualsNoCase(name)); if ( it == e ) return NULL; return *it; }
/*public*/ void Node::setLabelBoundary(int argIndex) { int loc = label.getLocation(argIndex); // flip the loc int newLoc; switch (loc){ case Location::BOUNDARY: newLoc=Location::INTERIOR; break; case Location::INTERIOR: newLoc=Location::BOUNDARY; break; default: newLoc=Location::BOUNDARY; break; } label.setLocation(argIndex, newLoc); testInvariant(); }
PrinterParams::PrinterParams() { target = PRINTER; file_name = std::string(); all_pages = true; from_page = 1; to_page = 0; odd_pages = true; even_pages = true; count_copies = 1; sorted_copies = false; reverse_order = false; testInvariant(); }
/*protected*/ void EdgeRing::mergeLabel(const Label& deLabel, int geomIndex) { testInvariant(); int loc=deLabel.getLocation(geomIndex, Position::RIGHT); // no information to be had from this label if (loc==Location::UNDEF) return; // if there is no current RHS value, set it if (label.getLocation(geomIndex)==Location::UNDEF) { label.setLocation(geomIndex,loc); return; } }