Beispiel #1
0
/*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();
}
Beispiel #2
0
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();
}
Beispiel #3
0
int char_buffer::do_html(int argc, char *argv[])
{
  string s;

  alterDeviceTo(argc, argv, 0);
  argv += troff_arg;		// skip all arguments up to groff
  argc -= troff_arg;
  argv = addZ(argc, argv);
  argc++;

  s = "-dwww-image-template=";
  s += macroset_template;	// do not combine these statements,
				// otherwise they will not work
  s += '\0';                	// the trailing `\0' is ignored
  argv = addRegDef(argc, argv, s.contents());
  argc++;

#if defined(DEBUGGING)
# define HTML_DEBUG_STREAM  OUTPUT_STREAM(htmlFileName)
  // slight security risk so only enabled if compiled with defined(DEBUGGING)
  if (debug) {
    int saved_stdout = save_and_redirect(STDOUT_FILENO, HTML_DEBUG_STREAM);
    emit_troff_output(DEVICE_FORMAT(HTML_OUTPUT_FILTER));
    set_redirection(STDOUT_FILENO, saved_stdout);
  }
#endif

  return run_output_filter(HTML_OUTPUT_FILTER, argc, argv);
}
Beispiel #4
0
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
    assert(e->getCoordinate().equals2D(coord));

    // 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();
}
Beispiel #5
0
 ///
 /// 加算
 void add(Vec3& rhs) {
     addX(rhs.x_);
     addY(rhs.y_);
     addZ(rhs.z_);
 }
Beispiel #6
0
void Point::move(Point* other) {
    addX(other->getX());
    addY(other->getY());
    addZ(other->getZ());
}
bool
SMatrix::fillMatrix(double Frequency) {
 Pos_=0;
 double W=Frequency*2.0*M_PI;
 int X,Y;

 QValueList<OLElement>::Iterator it3;
 for ( it3 = Schematic_.OLList.begin(); it3 != Schematic_.OLList.end(); ++it3 ){
   addOL(true);
   if ((*it3).startNode()=="S1") { X = Pos_ - 2; }
   if ((*it3).startNode()=="S2") { Y = Pos_ - 2; }
 }
 S11_=MatrixDimension_*X+X;
 S12_=MatrixDimension_*X+Y;
 S21_=MatrixDimension_*Y+X;
 S22_=MatrixDimension_*Y+Y;
 QValueList<SCElement>::Iterator it4;
 for ( it4 = Schematic_.SCList.begin(); it4 != Schematic_.SCList.end(); ++it4 ){
   addSC();
 }
 QValueList<RCLElement>::Iterator it;
 for ( it = Schematic_.RList.begin(); it != Schematic_.RList.end(); ++it ){
  addZ(std::complex<double>((*it).value(),0.0));
 }
 for ( it = Schematic_.LList.begin(); it != Schematic_.LList.end(); ++it ){
  addZ(std::complex<double>(0.0,W*(*it).value()));
 }
 for ( it = Schematic_.CList.begin(); it != Schematic_.CList.end(); ++it ){
  addZ(std::complex<double>(0.0,-1.0/(W*(*it).value())));
 }
 QValueList<CCElement>::Iterator it2;
 for ( it2 = Schematic_.VCCSList.begin(); it2 != Schematic_.VCCSList.end(); ++it2 ){
   addCS(std::polar(2.0*(*it2).value(),(M_PI-W*(*it2).tau())),
         std::polar(2.0*(*it2).value(),(-W*(*it2).tau())), false, false);
  }
 for ( it2 = Schematic_.VCVSList.begin(); it2 != Schematic_.VCVSList.end(); ++it2 ){
   addCS(std::polar((*it2).value(),(-W*(*it2).tau())),
         std::polar((*it2).value(),(M_PI-W*(*it2).tau())), true, false);
  }
 for ( it2 = Schematic_.CCCSList.begin(); it2 != Schematic_.CCCSList.end(); ++it2 ){
   addCS(std::polar((*it2).value(),(M_PI-W*(*it2).tau())), 
         std::polar((*it2).value(),(-W*(*it2).tau())), false, true);
  }
 for ( it2 = Schematic_.CCVSList.begin(); it2 != Schematic_.CCVSList.end(); ++it2 ){
   addCS(std::polar((*it2).value()/2.0,(-W*(*it2).tau())),
         std::polar((*it2).value()/2.0,(M_PI-W*(*it2).tau())), true, true);
  }
 QValueList<NodeElement>::Iterator it5;
 for ( it5 = Schematic_.Nodes.Nodes.begin(); it5 != Schematic_.Nodes.Nodes.end(); ++it5 ){
  if ((*it5).Numbers_.count()>2) {
    addNode((*it5).Numbers_.count());
    if (!FormulaExists_) {
      int tmpCount = Pos_ - (*it5).Numbers_.count() + 1 ;
      for ( unsigned int i = 0; i < (*it5).Numbers_.count(); i++) {
       ChopUp.List.push_back(ChopUpElement(tmpCount, (*it5).Numbers_[i]));
       ChopUp.List.push_back(ChopUpElement((*it5).Numbers_[i], tmpCount));
       tmpCount++;
     }
    }
  } else {
   if (!FormulaExists_) {
     if ((*it5).Numbers_.count()==2) {
       ChopUp.List.push_back(ChopUpElement((*it5).Numbers_[0], (*it5).Numbers_[1]));
       ChopUp.List.push_back(ChopUpElement((*it5).Numbers_[1], (*it5).Numbers_[0]));
     }
   }
  }
 }
 return true;
}