- Author:
- Catherine Lloyd <c.lloyd@auckland.ac.nz>
- Date:
- 2010-07-01 03:22:35+12:00
- Desc:
- Removed xml:base="" from the model.
- Permanent Source URI:
- http://models.cellml.org/workspace/lenbury_pacheenburawana_1991/rawfile/3ece2f89daabcdeab34824f5833fd2bc270b308c/lenbury_1991.xul
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="layout-diagram" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" style="overflow: auto" onload="setupDocument()">
<hbox>
<scale id="zoom_scale" value="10" min="7" max="14" flex="4"/>
<label value="Zoom" control="zoom_scale" flex="1"/>
<button id="reset_button" label="Reset View" flex="1"/>
<spacer flex="34"/>
</hbox>
<script>
<![CDATA[
window.model_entities =
{
x: {
id: "x",
y: "x/x",
x: "environment/time",
graph: "Traces: Clickable Elements Against Time (s)",
colour: "#ff9900",
linestyle: "none"
},
y: {
id: "y",
y: "y/y",
x: "environment/time",
graph: "Traces: Clickable Elements Against Time (s)",
colour: "#ff00cc",
linestyle: "none"
},
z: {
id: "z",
y: "z/z",
x: "environment/time",
graph: "Traces: Clickable Elements Against Time (s)",
colour: "#cc00ff",
linestyle: "none"
}
// Repeat the above section for each controllable graph trace.
// Remember to add a comma to each repeat after the final },
// except for the final one!
};
function flushVisibilityInformation(entity_id, entity_colour)
{
var message = "";
var entity;
if (typeof pcenv != "undefined")
{
for (var i in window.model_entities)
{
entity = window.model_entities[i];
if (typeof entity_id == "undefined" || entity_id == window.model_entities[i].id)
{
pcenv.selectTrace
(
entity.graph,
entity.x,
entity.y,
typeof entity_colour == "undefined" ? "" : entity_colour,
entity.linestyle
);
}
if (entity.linestyle != "none")
message += i + ", ";
}
pcenv.status(message == "" ? "No fluxes displayed" : "Displaying flux of " + message.slice(0, -2));
}
}
function processSelectEntity(event)
{
if (typeof pcenv != "undefined")
pcenv.status("In processSelectEntity");
var entity = window.model_entities[window.svgIdToName[event.currentTarget.id]];
switch(entity.linestyle)
{
case "none":
entity.linestyle = "lines";
highlightEntity(event.currentTarget.id);
break;
case "lines":
entity.linestyle = "none";
unlightEntity(event.currentTarget.id);
break;
}
flushVisibilityInformation(entity.id);
}
function processContext(event)
{
// if (event.button != 2)
// return true;
var entity = window.model_entities[window.svgIdToName[event.currentTarget.id]];
if (entity.context == null)
return true;
var menu = document.getElementById("entityContextMenu");
for (var c = menu.firstChild, x = null; c != null; c = x)
{
x = c.nextSibling;
menu.removeChild(c);
}
for (var i in entity.context)
{
var item = entity.context[i];
var mitem = document.createElementNS
(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"menuitem"
);
mitem.setAttribute("label", item.label);
mitem.setAttribute("url", item.url);
mitem.addEventListener("command", processShowEntityURL, false);
menu.appendChild(mitem);
}
menu.showPopup(window.diagram, event.screenX, event.screenY, "context");
event.stopPropagation;
return false;
}
function processShowEntityURL(event)
{
url = event.target.getAttribute("url");
window.open(url);
var hl = document.getElementById("hidden-link");
hl.href = url;
// This is ugly, but it is one way to force everything through the proper
// external handler...
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);
hl.dispatchEvent(evt);
}
function highlightEntity(id)
{
for (var path = document.getElementById(id + "_path1"), i = 1; path != null; path = document.getElementById(id + "_path" + ++i))
{
if (!(i in window.model_entities[window.svgIdToName[id]].path_colours))
window.model_entities[window.svgIdToName[id]].path_colours[i] = path.attributes.getNamedItem("stroke").value;
path.attributes.getNamedItem("stroke").value = "#ff0000";
}
}
function highlightEntityOnRollover(event) {
if (window.model_entities[window.svgIdToName[event.currentTarget.id]].colour)
flushVisibilityInformation(event.currentTarget.id, "#ffffff");
if (window.model_entities[window.svgIdToName[event.currentTarget.id]].linestyle == "none")
highlightEntity(event.currentTarget.id);
}
function unlightEntity(id)
{
for (var path = document.getElementById(id + "_path1"), i = 1; path != null; path = document.getElementById(id + "_path" + ++i))
path.attributes.getNamedItem("stroke").value = window.model_entities[window.svgIdToName[id]].path_colours[i];
}
function unlightEntityOnRollover(event) {
if (window.model_entities[window.svgIdToName[event.currentTarget.id]].colour)
flushVisibilityInformation(event.currentTarget.id, window.model_entities[window.svgIdToName[event.currentTarget.id]].colour);
if (window.model_entities[window.svgIdToName[event.currentTarget.id]].linestyle == "none")
unlightEntity(event.currentTarget.id);
}
var mouseDown = false;
var initial_x;
var initial_y;
var viewBox;
function startDrag(event)
{
if (event.button)
return true;
mouseDown = true;
initial_x = parseInt(currentZoom * event.pageX + parseInt(viewBox.value.match(/^-?\d+/)[0]));
initial_y = parseInt(currentZoom * event.pageY + parseInt(viewBox.value.match(/^-?\d+\s+(-?(\d+))/)[1]));
}
function stopDrag(event)
{
if (!event.button)
mouseDown = false;
}
function moveDrag(event)
{
if (mouseDown == true)
viewBox.value = viewBox.value.replace(/^-?\d+\s+-?\d+/, parseInt(initial_x - currentZoom * event.pageX) + " " + parseInt(initial_y - currentZoom * event.pageY));
}
function reset()
{
var zoom_scale = document.getElementById("zoom_scale")
zoom_scale.value = zoom_scale.originalValue;
viewBox.value = viewBox.originalValue;
}
var initialZoom;
var currentZoom = 1;
var initialHeight;
var initialWidth;
function zoomDiagram(event)
{
currentZoom = initialZoom / event.currentTarget.value;
viewBox.value = viewBox.value.replace(/\d+\s+\d+$/, parseInt(initialHeight * currentZoom) + " " + parseInt(initialWidth * currentZoom));
}
function setupDocument()
{
flushVisibilityInformation();
window.diagram = document.getElementById("sachse");
window.svgIdToName = {};
for (var name in window.model_entities)
{
var id = window.model_entities[name].id;
window.model_entities[name].path_colours = [];
var svg = document.getElementById(id);
window.svgIdToName[id] = name;
svg.addEventListener("click", processSelectEntity, false);
svg.addEventListener("contextmenu", processContext, false);
svg.addEventListener("mouseover", highlightEntityOnRollover ,false);
svg.addEventListener("mouseout", unlightEntityOnRollover, false);
}
document.getElementsByTagName("svg")[0].addEventListener("mousedown", startDrag, false);
document.addEventListener("mouseup", stopDrag, false);
document.addEventListener("mousemove", moveDrag, false);
document.getElementById("reset_button").addEventListener("click", reset, false);
document.getElementById("zoom_scale").addEventListener("change", zoomDiagram, false);
document.getElementById("zoom_scale").originalValue = document.getElementById("zoom_scale").value;
viewBox = document.getElementsByTagName("svg")[0].attributes.getNamedItem("viewBox");
viewBox.originalValue = viewBox.value;
initialZoom = document.getElementById("zoom_scale").value;
initialHeight = parseInt(viewBox.value.match(/(\d+)\s+\d+$/)[1]);
initialWidth = parseInt(viewBox.value.match(/\d+$/)[0]);
}
]]>
</script>
<popupset>
<menupopup id="entityContextMenu" />
</popupset>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="423px" height="486px" viewBox="0 0 423 486" enable-background="new 0 0 423 486" xml:space="preserve">
<g>
<g>
<path fill="none" stroke="#2E3191" d="M215.335,53.203C239.509,29.029,309.78,33.779,334.002,58"/>
<polygon fill="#2E3191" points="214.702,48.599 216.209,52.329 219.94,53.836 211.114,57.424 "/>
</g>
</g>
<g id="x">
<path fill="#40AE74" d="M88.103,95.396c0,2.75-2.25,5-5,5H17.436c-2.75,0-5-2.25-5-5v-33c0-2.75,2.25-5,5-5h65.667
c2.75,0,5,2.25,5,5V95.396z"/>
<path id="x_path1" fill="none" stroke="#000000" d="M88.103,95.396c0,2.75-2.25,5-5,5H17.436c-2.75,0-5-2.25-5-5v-33
c0-2.75,2.25-5,5-5h65.667c2.75,0,5,2.25,5,5V95.396z"/>
</g>
<g>
<path d="M44.188,83.784c-0.576,0.288-1.729,0.594-3.205,0.594c-3.421,0-5.995-2.179-5.995-6.158c0-3.799,2.574-6.374,6.338-6.374
c1.512,0,2.467,0.324,2.881,0.54l-0.378,1.278c-0.595-0.288-1.439-0.504-2.449-0.504c-2.845,0-4.734,1.818-4.734,5.006
c0,2.971,1.711,4.879,4.663,4.879c0.954,0,1.927-0.197,2.557-0.504L44.188,83.784z"/>
<path d="M46.147,72.206c0.792-0.162,1.927-0.252,3.007-0.252c1.675,0,2.755,0.306,3.512,0.99c0.611,0.54,0.954,1.369,0.954,2.305
c0,1.603-1.009,2.665-2.287,3.097V78.4c0.938,0.324,1.495,1.188,1.783,2.449c0.396,1.691,0.684,2.862,0.936,3.33h-1.619
c-0.198-0.359-0.469-1.386-0.812-2.898c-0.358-1.674-1.008-2.305-2.431-2.359h-1.478v5.258h-1.565V72.206z M47.714,77.734h1.604
c1.675,0,2.737-0.918,2.737-2.305c0-1.566-1.136-2.252-2.791-2.27c-0.757,0-1.298,0.072-1.55,0.145V77.734z"/>
<path d="M57.398,72.044v5.078h5.87v-5.078h1.584V84.18h-1.584V78.49h-5.87v5.689h-1.566V72.044H57.398z"/>
</g>
<g id="y">
<path fill="#40AE74" d="M236.368,95.396c0,2.75-2.25,5-5,5h-66c-2.75,0-5-2.25-5-5v-33c0-2.75,2.25-5,5-5h66c2.75,0,5,2.25,5,5
V95.396z"/>
<path id="y_path1" fill="none" stroke="#000000" d="M236.368,95.396c0,2.75-2.25,5-5,5h-66c-2.75,0-5-2.25-5-5v-33
c0-2.75,2.25-5,5-5h66c2.75,0,5,2.25,5,5V95.396z"/>
</g>
<g>
<path d="M180.514,80.361l-1.261,3.816h-1.621l4.123-12.136h1.892l4.143,12.136h-1.676l-1.295-3.816H180.514z M184.494,79.137
l-1.188-3.492c-0.271-0.793-0.449-1.513-0.632-2.214h-0.034c-0.181,0.72-0.38,1.458-0.611,2.196l-1.189,3.511H184.494z"/>
<path d="M197.777,83.783c-0.576,0.287-1.729,0.594-3.205,0.594c-3.42,0-5.994-2.179-5.994-6.158c0-3.799,2.574-6.374,6.338-6.374
c1.512,0,2.467,0.324,2.881,0.54l-0.379,1.278c-0.594-0.288-1.438-0.504-2.449-0.504c-2.844,0-4.733,1.819-4.733,5.006
c0,2.971,1.711,4.879,4.662,4.879c0.955,0,1.928-0.198,2.557-0.504L197.777,83.783z"/>
<path d="M202.545,73.375h-3.688v-1.333h8.983v1.333h-3.709v10.803h-1.586V73.375z"/>
<path d="M210.754,72.043v5.078h5.869v-5.078h1.584V84.18h-1.584V78.49h-5.869v5.689h-1.565V72.043H210.754z"/>
</g>
<g id="z">
<path fill="#40AE74" d="M384.467,95.396c0,2.75-2.25,5-5,5h-66c-2.75,0-5-2.25-5-5v-33c0-2.75,2.25-5,5-5h66c2.75,0,5,2.25,5,5
V95.396z"/>
<path id="z_path1" fill="none" stroke="#000000" d="M384.467,95.396c0,2.75-2.25,5-5,5h-66c-2.75,0-5-2.25-5-5v-33
c0-2.75,2.25-5,5-5h66c2.75,0,5,2.25,5,5V95.396z"/>
</g>
<g>
<path d="M343.453,72.043h6.536v1.314h-4.971v4.034h4.593v1.295h-4.593v5.492h-1.565V72.043z"/>
</g>
<g>
<g>
<path fill="none" stroke="#2E3191" d="M37.333,52.667C103.518-6.835,297.85-2.12,364.166,57.5"/>
<polygon fill="#2E3191" points="36.946,48.035 38.252,51.841 41.898,53.544 32.895,56.658 "/>
</g>
</g>
<g>
<g>
<path fill="none" stroke="#2E3191" d="M66,52.87c24.174-24.174,94.445-19.424,118.667,4.797"/>
<polygon fill="#2E3191" points="65.368,48.265 66.874,51.996 70.605,53.503 61.779,57.09 "/>
</g>
</g>
<g>
<g>
<path fill="none" stroke="#EC1C24" d="M179.538,105.242c-24.174,24.174-94.445,19.424-118.667-4.797"/>
<polygon fill="#EC1C24" points="180.171,109.846 178.664,106.116 174.933,104.607 183.759,101.021 "/>
</g>
</g>
<g>
<g>
<path fill="none" stroke="#EC1C24" d="M330.706,105.575c-24.174,24.174-94.445,19.424-118.667-4.798"/>
<polygon fill="#EC1C24" points="331.339,110.18 329.832,106.449 326.1,104.941 334.927,101.354 "/>
</g>
</g>
<g>
<path fill="#2E3191" d="M125.003,30.851v0.9H116v-0.9H125.003z"/>
</g>
<g>
<path fill="#2E3191" d="M277.003,30.851v0.9H268v-0.9H277.003z"/>
</g>
<g>
<path fill="#EC1C24" d="M122.571,125.421v4.231h4.069v1.08h-4.069V135h-1.152v-4.268h-4.068v-1.08h4.068v-4.231H122.571z"/>
</g>
<g>
<path fill="#EC1C24" d="M273.738,125.421v4.231h4.068v1.08h-4.068V135h-1.152v-4.268h-4.069v-1.08h4.069v-4.231H273.738z"/>
</g>
</svg>
</window>