Beispiel #1
0
	public override string exportX3D(Object3dEnvironment env) {
		// Step 1: Collect base linepieces that would draw the basic structure
		List<ObjectLinePiece> baseLinePieces = new List<ObjectLinePiece>();		
		foreach (PlaneBorderEnclosedVolume aSubVolume in this.subVolumes) {
			baseLinePieces.AddRange(aSubVolume.getOLPBorderEdges());
			}

		// Step 2: Slice all linepieces that are intersected by other subVolumes
		List<ObjectLinePiece> slicedLinePieces = new List<ObjectLinePiece>();
		foreach (ObjectLinePiece anOLP in baseLinePieces) {
			// Distances/linepieces smaller than "significance" are considered insignificant ignored.
			if(anOLP.lp.getLength() < MainClass.SIGNIFICANTLY_SMALL)
				continue;
			List<ObjectLinePiece> olpChunks = new List<ObjectLinePiece>();
			List<ObjectLinePiece> newOLPChunks = new List<ObjectLinePiece>();
			
			olpChunks.Add(anOLP);
			foreach (PlaneBorderEnclosedVolume aSubVolume in this.subVolumes) {
				newOLPChunks = new List<ObjectLinePiece>();	//create empty new list
				foreach (ObjectLinePiece anOLPChunk in olpChunks) {
					newOLPChunks.AddRange(aSubVolume.sliceObjectLinePiece(anOLPChunk));
					} // end oldChunks
				olpChunks = newOLPChunks;
				} // end subVolumes
			
			slicedLinePieces.AddRange(newOLPChunks);
			} // end anOLP loop
		

		List<ObjectLinePiece> markedSlices = this.markInsideOutsideOLPs(this.cleanupLinePieceList(slicedLinePieces));

		Console.WriteLine("ComplexBorder gridline count: "+markedSlices.Count+" out of "+slicedLinePieces.Count);
		double foo = 0;
		foreach (ObjectLinePiece anOLP in markedSlices) {
			//foo += env.radius/2000;
			anOLP.lp.startingpoint.x= anOLP.lp.startingpoint.x + foo;
			anOLP.lp.endingpoint.x= anOLP.lp.endingpoint.x + foo;
			anOLP.lp.startingpoint.y= anOLP.lp.startingpoint.y + foo;
			anOLP.lp.endingpoint.y= anOLP.lp.endingpoint.y + foo;
			}

		// draw the linepieces after having checked and marked what's inside and outside
		//return LinePiece.drawLinePiecesXML(this.markInsideOutsideOLPs(baseLinePieces)); // <-- show non-sliced pieces only.
		string line_pieces_xml = LinePiece.drawLinePiecesXML(markedSlices);
		if (line_pieces_xml.Length < 1)
			Console.WriteLine("WARNING: the volume {"+this.tag+"} cannot be drawn.");
		return "<!-- ComplexVolume: "+this.tag+" -->"+line_pieces_xml+"<!-- END OF ComplexVolume: "+this.tag+" -->";
		}
Beispiel #2
0
        static public string drawLinePiecesXML(List <LinePiece> linePieces, string colour)
        {
            List <ObjectLinePiece> olps = new List <ObjectLinePiece>();

            foreach (LinePiece lp in linePieces)
            {
                ObjectLinePiece tolp = new ObjectLinePiece();
                tolp.col = colour;
                tolp.lp  = lp;
                olps.Add(tolp);
            }
            return(LinePiece.drawLinePiecesXML(olps));

            /*System.Text.StringBuilder retstr = new System.Text.StringBuilder(5000);
             * foreach (LinePiece lp in linePieces) {
             *      retstr.Append(X3DGridPoint.get_RGBA_Line_XML(lp, colour));
             *      }
             * return retstr.ToString(); */
        }
        public override string exportX3D(Object3dEnvironment env)
        {
            List <ObjectLinePiece> olps = this.getOLPBorderEdges();

            return(LinePiece.drawLinePiecesXML(olps));
        }