<commit_before><?php
namespace Phen;

class HelioRoom extends \PhenLib\Page
{
	public function __construct()
	{
		parent::__construct();

		$rootDoc = \PhenLib\Template::getDOC();
		$root = $this->root;

		$html = <<<EOHTML
<script type="text/javascript">
<!--
function HelioRoomSolarSystem( container_id, windows, degrees )
{
	//static var
	HelioRoomSolarSystem.svgns = "http://www.w3.org/2000/svg";

	//init values
//TODO - make this error output into the svg itself
	if( windows * degrees > 360 )
	{
		alert( "invalid solar system arguments" );
		return null;
	}
	this.windows = windows;
	this.degrees = degrees;

	//create svg canvas
	this.svg = document.createElementNS( HelioRoomSolarSystem.svgns, "svg" );
	this.svg.setAttribute( "width", "500" );
	this.svg.setAttribute( "height", "500" );
	this.svg.setAttribute( "viewbox", "0 0 500 500" );
	this.svg.setAttribute( "preserveAspectRatio", "xMidYMid meet" );

	//create svg group for sectors, reference array for sectors
	var sector_group = document.createElementNS( HelioRoomSolarSystem.svgns, "g");
	this.sectors = new Array(16);
	for( var x = 0; x < 16; x++ )
	{
		this.sectors[x] = document.createElementNS( HelioRoomSolarSystem.svgns, "path");
		sector_group.appendChild( this.sectors[x] );
	}
		
	//create svg group for rings
	this.rings = document.createElementNS( HelioRoomSolarSystem.svgns, "g");

	//link dom elements together
	this.svg.appendChild( sector_group );
	this.svg.appendChild( this.rings );
	document.getElementById( container_id ).appendChild( this.svg );

	//draw things
	this.drawSectors();
	this.drawRings();
}

HelioRoomSolarSystem.prototype.setWindows = function( windows )
{
	//out of bounds from ui specification
	if( windows < 4 || windows > 8 )
		return false;

	//update values
	this.windows = windows;
	this.degrees = 180 / windows;
	return true;
};

HelioRoomSolarSystem.prototype.getWindows = function()
{
	return this.windows;
};

HelioRoomSolarSystem.prototype.setViewAngle = function( degrees )
{
	//windows * degrees bigger than the circle
	if( this.windows * degrees > 360 )
		return false;

	//update value
	this.degrees = degrees;
	return true;
};

HelioRoomSolarSystem.prototype.getViewAngle = function()
{
	return this.degrees;
};

HelioRoomSolarSystem.prototype.drawSectors = function()
{
	console.log( "drawSectors" );
	//*** adapted from:
	//    http://jmvidal.cse.sc.edu/talks/canvassvg/javascriptandsvg.xml ***//

	//cx, cy, r: the center and radius of the pie
	var cx = 250;<commit_msg>Minor change - remove debug output<commit_after><?php
namespace Phen;

class HelioRoom extends \PhenLib\Page
{
	public function __construct()
	{
		parent::__construct();

		$rootDoc = \PhenLib\Template::getDOC();
		$root = $this->root;

		$html = <<<EOHTML
<script type="text/javascript">
<!--
function HelioRoomSolarSystem( container_id, windows, degrees )
{
	//static var
	HelioRoomSolarSystem.svgns = "http://www.w3.org/2000/svg";

	//init values
//TODO - make this error output into the svg itself
	if( windows * degrees > 360 )
	{
		alert( "invalid solar system arguments" );
		return null;
	}
	this.windows = windows;
	this.degrees = degrees;

	//create svg canvas
	this.svg = document.createElementNS( HelioRoomSolarSystem.svgns, "svg" );
	this.svg.setAttribute( "width", "500" );
	this.svg.setAttribute( "height", "500" );
	this.svg.setAttribute( "viewbox", "0 0 500 500" );
	this.svg.setAttribute( "preserveAspectRatio", "xMidYMid meet" );

	//create svg group for sectors, reference array for sectors
	var sector_group = document.createElementNS( HelioRoomSolarSystem.svgns, "g");
	this.sectors = new Array(16);
	for( var x = 0; x < 16; x++ )
	{
		this.sectors[x] = document.createElementNS( HelioRoomSolarSystem.svgns, "path");
		sector_group.appendChild( this.sectors[x] );
	}
		
	//create svg group for rings
	this.rings = document.createElementNS( HelioRoomSolarSystem.svgns, "g");

	//link dom elements together
	this.svg.appendChild( sector_group );
	this.svg.appendChild( this.rings );
	document.getElementById( container_id ).appendChild( this.svg );

	//draw things
	this.drawSectors();
	this.drawRings();
}

HelioRoomSolarSystem.prototype.setWindows = function( windows )
{
	//out of bounds from ui specification
	if( windows < 4 || windows > 8 )
		return false;

	//update values
	this.windows = windows;
	this.degrees = 180 / windows;
	return true;
};

HelioRoomSolarSystem.prototype.getWindows = function()
{
	return this.windows;
};

HelioRoomSolarSystem.prototype.setViewAngle = function( degrees )
{
	//windows * degrees bigger than the circle
	if( this.windows * degrees > 360 )
		return false;

	//update value
	this.degrees = degrees;
	return true;
};

HelioRoomSolarSystem.prototype.getViewAngle = function()
{
	return this.degrees;
};

HelioRoomSolarSystem.prototype.drawSectors = function()
{
	//*** adapted from:
	//    http://jmvidal.cse.sc.edu/talks/canvassvg/javascriptandsvg.xml ***//

	//cx, cy, r: the center and radius of the pie
	var cx = 250;
{'fraction_non_alphanumeric': 0.13680192848533548, 'fraction_numerical': 0.015267175572519083, 'mean_word_length': 4.219077568134172, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '6371463', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1666, 'n_words': 413}