<commit_before>package br.odb.derelict;

import br.odb.libscene.GroupSector;
import br.odb.libscene.SpaceRegion;
import br.odb.libscene.World;
import br.odb.libstrip.IndexedSetFace;

public class SVGRenderer {

	private static String generateSVGForSector(GroupSector sector) {
		
		String toReturn = "";
				
//		if ( sector.colorForDirection.get( Direction.CEILING ) == null ) {
//			quad = new GeneralQuad();
//			quad.vertex[ 0 ].set( sector.position );
//			quad.vertex[ 2 ].set( sector.position.add( sector.size ) );
//			quad.color.set( sector.colorForDirection.get( Direction.CEILING ) );
//			sector.mesh.addFace( quad );
//		}
//
//		if ( sector.colorForDirection.get( Direction.FLOOR ) == null ) {
//			quad = new GeneralQuad();
//			quad.vertex[ 0 ].set( sector.position );
//			quad.vertex[ 2 ].set( sector.position.add( sector.size ) );
//			quad.color.set( sector.colorForDirection.get( Direction.FLOOR ) );
//			sector.mesh.addFace( quad );
//		}
		
		for ( IndexedSetFace isf : sector.mesh.faces ) {
			toReturn += "<rect ";
			
			toReturn += " x = '" + isf.getVertex( 0 ).x + "' ";
			toReturn += " y = '" + isf.getVertex( 0 ).z + "' ";
			toReturn += " id = '" + sector.id + "' ";
			toReturn += " width = '" + ( isf.getVertex( 2 ).x - isf.getVertex( 0 ).x ) + "' ";
			toReturn += " height = '" + ( isf.getVertex( 2 ).z - isf.getVertex( 0 ).z ) + "' ";
			
			toReturn += " style = 'fill: " + isf.getColor().getHTMLColor() + ";' ";
			
			toReturn += " />\n";
		}
		
		for ( SpaceRegion sr : sector.getSons() ) {
			if ( sr instanceof GroupSector ) {
				toReturn += generateSVGForSector( (GroupSector) sr );
			}
		}
		
		return toReturn;
	}

	
	public static String renderXZ( World world ) {
		String toReturn= "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n<svg xmlns='http://www.w3.org/2000/svg'>\n" + generateSVGForSector( world.masterSector ) + "\n</svg>";
		return toReturn;
	}
}<commit_msg>changed the SVG rendering, to that each GroupSector node in the scene generates a SVG group (<g/>). This makes a perfect translation on the scene hierarchy.<commit_after>package br.odb.derelict;

import br.odb.libscene.GroupSector;
import br.odb.libscene.SpaceRegion;
import br.odb.libscene.World;
import br.odb.libstrip.IndexedSetFace;

public class SVGRenderer {

	private static String generateSVGForSector(GroupSector sector) {
		
		String toReturn = "<g id='" + sector.id + "' >";
				
		for ( IndexedSetFace isf : sector.mesh.faces ) {
			toReturn += "<rect ";
			
			toReturn += " x = '" + isf.getVertex( 0 ).x + "' ";
			toReturn += " y = '" + isf.getVertex( 0 ).z + "' ";
			toReturn += " width = '" + ( isf.getVertex( 2 ).x - isf.getVertex( 0 ).x ) + "' ";
			toReturn += " height = '" + ( isf.getVertex( 2 ).z - isf.getVertex( 0 ).z ) + "' ";
			
			toReturn += " style = 'fill: " + isf.getColor().getHTMLColor() + ";' ";
			
			toReturn += " />\n";
		}
		
		for ( SpaceRegion sr : sector.getSons() ) {
			if ( sr instanceof GroupSector ) {
				toReturn += generateSVGForSector( (GroupSector) sr );
			}
		}
		
		toReturn += "</g>";
		
		return toReturn;
	}

	
	public static String renderXZ( World world ) {
		String toReturn= "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n<svg xmlns='http://www.w3.org/2000/svg'>\n" + generateSVGForSector( world.masterSector ) + "\n</svg>";
		return toReturn;
	}
}
{'fraction_non_alphanumeric': 0.1817910447761194, 'fraction_numerical': 0.00955223880597015, 'mean_word_length': 3.027644230769231, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 2, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6542061', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1180, 'n_words': 255}