⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapplotter.as

📁 Network Management Information System
💻 AS
字号:
/**************************************
 * Map-Plotter
 **************************************/
 
// initialize
fontSize = parseInt(fontSize);
nodeSize = parseInt(nodeSize);

// Node text format
with(nodeTextFormat){
	color = fgcolor;
	font = "Verdana";
	size = fontSize;
	bold = true;
}
 
// Legend entries
for(param in _root){
	if(param.substr(0, 6).toLowerCase() == "entry_"){
		delete(data_array);
		data_array = _root[param].split(";");
		obj = new Object();
		obj.min = parseFloat(data_array[0]);
		obj.max = parseFloat(data_array[1]);
		obj.color = data_array[2];
		obj.label = data_array[3];
		aEntries.push(obj);
	}	
}

// Nodes
for(param in _root){	
	if(param.substr(0, 5).toLowerCase() == "node_"){
		delete(data_array);  // free memory
		data_array = _root[param].split(";");		
		nodes[data_array[0]] = new Node(parseFloat(data_array[1]), parseFloat(data_array[2]), data_array[3], parseInt(data_array[4]), data_array[5], parseInt(data_array[6]));
	}
}	
	
// Links
for(param in _root){
	if(param.substr(0,5).toLowerCase() == "link_"){
		delete(data_array);
		data_array = _root[param].split(";");		
		links.push(new Link(data_array[0], data_array[1], data_array[2], data_array[3]));		
	}	
}	


// load the image
_root.createEmptyMovieClip("picClip", 0);
picClip.loadMovie(img);



/**************************************
 * Legend
 **************************************/
// get the legend data
delete(data_array);
data_array = legend.split(";");
leg.x = parseInt(data_array[0]);
leg.y = parseInt(data_array[1]);
leg.width = parseInt(data_array[2]);
leg.height = parseInt(data_array[3]);
leg.title = data_array[4];
leg.fontSize = parseInt(data_array[5]);
leg.fontPixelSize = leg.fontSize * 1.5;

// draw the box
_root.createEmptyMovieClip("keyClip", 9999);
with(keyClip){
	lineStyle(2, fgColor);	
	moveTo(leg.x, leg.y);
	lineTo(leg.x + leg.width, leg.y);
	lineTo(leg.x + leg.width, leg.y + leg.height);
	lineTo(leg.x, leg.y + leg.height);
	lineTo(leg.x, leg.y);
	
	// fill the box with white
	moveTo(leg.x + 2, leg.y + 2);
	beginFill(0xffffff);
	lineStyle(2, 0xffffff);
	lineTo(leg.x + leg.width - 2, leg.y + 2);
	lineTo(leg.x + leg.width - 2, leg.y + leg.height - 2);
	lineTo(leg.x + 2, leg.y + leg.height - 2);
	lineTo(leg.x + 2, leg.y + 2);
	endFill();
}

// Legend text format
with(legendFormat){
	color = fgcolor;
	font = "Verdana";
	size = leg.fontSize;
}

// heading
_root.createTextField("legendHeading", 10000, leg.x + 3, leg.y, leg.title.length * leg.fontSize, leg.fontPixelSize);
legendHeading.text = leg.title;
legendHeading.setTextFormat(legendFormat);

// draw the entries
aEntries.reverse();
for(var i=0; i<aEntries.length; i++){
	obj = aEntries[i];
	
	with(obj){
	
		// label
		_root.createTextField(label, 10001 + i, leg.x + 25, leg.y + ((i + 1) * leg.fontPixelSize), label.length * leg.fontSize, leg.fontPixelSize);
		_root[obj.label].text = obj.label;
		_root[obj.label].setTextFormat(legendFormat);
		
		// color box
		delete(p1);
		delete(p2);
		delete(p3);
		delete(p4);
		p1 = new Point(leg.x + 5, leg.y + 4 + ((i + 1) * leg.fontPixelSize));
		p2 = new Point(p1.x + leg.fontSize, p1.y);
		p3 = new Point(p2.x, p2.y + leg.fontSize);
		p4 = new Point(p1.x, p3.y);
		keyClip.beginFill(color);
		keyClip.lineStyle(1, color);
		keyClip.moveTo(p1.x, p1.y);
		keyClip.lineTo(p2.x, p2.y);
		keyClip.lineTo(p3.x, p3.y);
		keyClip.lineTo(p4.x, p4.y);
		keyClip.lineTo(p1.x, p1.y);
		keyClip.endFill();
	}
}


// draw the nodes
for(var n in nodes){
	nodes[n].draw(0);
	nodes[n].drawLabel();
} 


// draw the links
for(var l in links){
	links[l].draw(0);	
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -