configreport.xsl
来自「Application Note Abstract The unique co」· XSL 代码 · 共 2,215 行 · 第 1/5 页
XSL
2,215 行
var nStart = 0;
var nEnd = nPinsPerSide;
for (var i = 0; i < nEnd; i++)
{
//calc y
var yLabel = nPinBodyY + (2*nPinHeight) + (i * (2*nPinHeight)) -(nPinHeight/2) + g_PO_FontHeight/2 + g_PO_InteriorLableCX/2;
//PIN LABEL
{
var sText = PO_GetFormattedPinLabel(i);
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", nPinBodyX + 10);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
textNode = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(textNode);
g_PO_SVGRoot.appendChild(mytext);
}
//DRAW PIN
{
var sdValue = "M " + nPinBodyX + " " + nPinBodyY
+ " m 0 " + (nCurPinOffSet + g_PO_InteriorLableCX/2)
+ " l -" + nPinWidth + " 0"
+ " l 0 " + nPinHeight
+ " l " + nPinWidth + " 0 ";
var mypath;
mypath = g_PO_SVGDoc.createElement("path");
mypath.setAttribute("d", sdValue);
var sStyleString = PO_GetPinFillColor(i);
mypath.setAttribute("fill", sStyleString);
mypath.setAttribute("stroke", "black");
mypath.setAttribute("stroke-width", "2");
g_PO_SVGRoot.appendChild(mypath);
}
//CUSTOM PIN LABEL
{
// get label
var sText = "";
mapStatus = g_PO_nodeList_PIN_DESC.item(i).attributes;
attrStatus = mapStatus.getNamedItem("PIN_CUSTOM_NAME");
if (attrStatus != null)
{
sText = attrStatus.value;
}
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", 125);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
mytext.setAttribute("text-anchor", "end");
var data = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
nCurPinOffSet += (nPinHeight*2);
}
// Propagate the event to other handlers.
return true;
}
/**************************************************************************
* PO_CreateLeftPins
* PO_CreateLeftPins for a 4 sided part
*
****************************************************************************/
function PO_CreateLeftPins(nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth)
{
var nCurPinOffSet = nPinHeight;
var nStart = 0;
var nEnd = nPinsPerSide;
for (var i = 0; i < nEnd; i++)
{
//calc y
var yLabel = nPinBodyY + (2*nPinHeight) + (i * (2*nPinHeight)) -(nPinHeight/2) + g_PO_FontHeight/2 ;
//PIN LABEL
{
var sText = PO_GetFormattedPinLabel(i);
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", nPinBodyX + 10);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
textNode = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(textNode);
g_PO_SVGRoot.appendChild(mytext);
}
//DRAW PIN
{
var sdValue = "M " + nPinBodyX + " " + nPinBodyY
+ " m 0 " + nCurPinOffSet
+ " l -" + nPinWidth + " 0"
+ " l 0 " + nPinHeight
+ " l " + nPinWidth + " 0 ";
var mypath;
mypath = g_PO_SVGDoc.createElement("path");
mypath.setAttribute("d", sdValue);
var sStyleString = PO_GetPinFillColor(i);
mypath.setAttribute("fill", sStyleString);
mypath.setAttribute("stroke", "black");
mypath.setAttribute("stroke-width", "2");
g_PO_SVGRoot.appendChild(mypath);
}
//CUSTOM PIN LABEL
{
// get label
var sText = "";
mapStatus = g_PO_nodeList_PIN_DESC.item(i).attributes;
attrStatus = mapStatus.getNamedItem("PIN_CUSTOM_NAME");
if (attrStatus != null)
{
sText = attrStatus.value;
}
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", 125);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
mytext.setAttribute("text-anchor", "end");
var data = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
nCurPinOffSet += (nPinHeight*2);
}
// Propagate the event to other handlers.
return true;
}
/**************************************************************************
* PO_CreateRightPins4
* PO_CreateRightPins4 for a 4 sided part
*
****************************************************************************/
function PO_CreateRightPins4(nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth)
{
var nCurPinOffSet = nPinHeight;
var nStart = (nPinsPerSide * 3) -1;
var nEnd = (nPinsPerSide * 2) -1;
var j = 0;
for (var i = nStart; i > nEnd; i--, j++)
{
//calc y
var yLabel = nPinBodyY + (2*nPinHeight) + (j * (2*nPinHeight)) -(nPinHeight/2) + g_PO_FontHeight/2 + g_PO_InteriorLableCX/2;
//PIN LABEL
{
var sText = PO_GetFormattedPinLabel(i);
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", nPinBodyX + g_PO_4nPinBodycXcY - 60 );
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
var data = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
//DRAW PIN
{
var sdValue = "M " + nPinBodyX + " " + nPinBodyY
+ " m " + g_PO_4nPinBodycXcY + " " + (nCurPinOffSet + g_PO_InteriorLableCX/2)
+ " l " + nPinWidth + " 0"
+ " l 0 " + nPinHeight
+ " l -" + nPinWidth + " 0 ";
var mypath;
mypath = g_PO_SVGDoc.createElement("path");
mypath.setAttribute("d", sdValue);
var sStyleString = PO_GetPinFillColor(i);
mypath.setAttribute("fill", sStyleString);
mypath.setAttribute("stroke", "black");
mypath.setAttribute("stroke-width", "2");
g_PO_SVGRoot.appendChild(mypath);
}
//CUSTOM PIN LABEL
{
// get label
var sText = "";
mapStatus = g_PO_nodeList_PIN_DESC.item(i).attributes;
attrStatus = mapStatus.getNamedItem("PIN_CUSTOM_NAME");
if (attrStatus != null)
{
sText = attrStatus.value;
}
var y = nPinBodyX + nCurPinOffSet +5; //start pos + offset + 5 for font
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", nPinBodyX + g_PO_4nPinBodycXcY + 1.5*nPinWidth);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
mytext.setAttribute("text-anchor", "start");
var data = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
nCurPinOffSet += (nPinHeight*2);
}
// Propagate the event to other handlers.
return true;
}
/**************************************************************************
* PO_CreateRightPins
* PO_CreateRightPins for a 2 sided part
*
****************************************************************************/
function PO_CreateRightPins(nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth)
{
var nCurPinOffSet = nPinHeight;
var nStart = g_PO_nodeList_PIN_DESC.length -1;
var nEnd = nPinsPerSide -1;
var j = 0;
for (var i = nStart; i > nEnd; i--, j++)
//for (var i = 0; i < 3; i++)
{
//calc y
var yLabel = nPinBodyY + (2*nPinHeight) + (j * (2*nPinHeight)) -(nPinHeight/2) + g_PO_FontHeight/2 ;
//PIN LABEL
{
var sText = PO_GetFormattedPinLabel(i);
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", nPinBodyX + 150);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
var data = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
//DRAW PIN
{
var sdValue = "M " + nPinBodyX + " " + nPinBodyY
+ " m " + nPinBodyWidth + " " + nCurPinOffSet
+ " l " + nPinWidth + " 0"
+ " l 0 " + nPinHeight
+ " l -" + nPinWidth + " 0 ";
var mypath;
mypath = g_PO_SVGDoc.createElement("path");
mypath.setAttribute("d", sdValue);
var sStyleString = PO_GetPinFillColor(i);
mypath.setAttribute("fill", sStyleString);
mypath.setAttribute("stroke", "black");
mypath.setAttribute("stroke-width", "2");
g_PO_SVGRoot.appendChild(mypath);
}
//CUSTOM PIN LABEL
{
// get label
var sText = "";
mapStatus = g_PO_nodeList_PIN_DESC.item(i).attributes;
attrStatus = mapStatus.getNamedItem("PIN_CUSTOM_NAME");
if (attrStatus != null)
{
sText = attrStatus.value;
}
var y = nPinBodyX + nCurPinOffSet +5; //start pos + offset + 5 for font
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", 375);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
mytext.setAttribute("text-anchor", "start");
var data = g_PO_SVGDoc.createTextNode(sText);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
nCurPinOffSet += (nPinHeight*2);
}
// Propagate the event to other handlers.
return true;
}
/**************************************************************************
* PO_CreateLegend
* PO_CreateLegend
*
****************************************************************************/
function PO_CreateLegend(nSides, nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth)
{
// we want to center x on pin
var legendWidth = 40;
var legendHeight = 20;
var nVertPins = nPinsPerSide;
var legendX;
var yPos;
if (nSides == 2)
{
yPos = nPinBodyY + (((nVertPins*2) + 1) * nPinHeight) + nPinHeight;
legendX = (nPinBodyX + (nPinBodyWidth/2) ) - legendWidth/2;
}
else
{
yPos = nPinBodyY + g_PO_4nPinBodycXcY + nPinWidth + g_PO_InteriorLableCX;
legendX = (nPinBodyX + (g_PO_4nPinBodycXcY/2) ) - legendWidth/2;
}
for (var i = 0 ; i < 5; i++)
{
if (i > 0)
{
yPos += (legendHeight);
}
var initPosStr = "M " + legendX + " " + yPos + " ";
var sdValue = initPosStr
+ "l " + legendWidth + " 0"
+ "l 0 " + legendHeight
+ "l -" + legendWidth + " 0"
+ "l 0 -" + legendHeight;
//rect
var mypath;
mypath = g_PO_SVGDoc.createElement("path");
mypath.setAttribute("d", sdValue);
mypath.setAttribute("fill", g_PO_ColorArray[i]);
mypath.setAttribute("stroke", "black");
mypath.setAttribute("stroke-width", "2");
g_PO_SVGRoot.appendChild(mypath);
//label
{
var xText = legendX + legendWidth + 5;
var yLabel = yPos + legendHeight -2;
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", xText);
mytext.setAttribute("y", yLabel);
mytext.setAttribute("style", "font-family:Verdana; font-size:10; fill:#000000");
var data = g_PO_SVGDoc.createTextNode(g_PO_ColorStringArray[i]);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
}
// Propagate the event to other handlers.
return true;
}
///////////////////////////////
/**************************************************************************
* PO_CreatePinBody
* PO_CreatePinBody
*
****************************************************************************/
function PO_CreatePinBody(nSides, nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth)
{
if (nSides==4)
{
PO_CreatePinBody4(nSides, nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth);
}
else
{
PO_CreatePinBody2(nSides, nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth);
}
}
/**************************************************************************
* PO_CreatePinBody2
* PO_CreatePinBody2
*
****************************************************************************/
function PO_CreatePinBody2(nSides, nPinsPerSide, nPinBodyWidth, nPinBodyX, nPinBodyY, nPinHeight, nPinWidth)
{
var nPinBodyHeight = ((nPinsPerSide*2) + 1) * nPinHeight;
<!-- big pin rect with ellipse-->
var rect;
rect = g_PO_SVGDoc.createElement("path");
var sRectData = "M " + nPinBodyX + " " + nPinBodyY + " l 90 0 a10,10 30 0,0 20,0 l 90 0"
+ " l 0 " + nPinBodyHeight
+ " l -" + nPinBodyWidth + " 0"
+ " l 0 -" + nPinBodyHeight;
rect.setAttribute("d", sRectData);
rect.setAttribute("fill", "white");
rect.setAttribute("stroke", "black");
rect.setAttribute("stroke-width", "2");
g_PO_SVGRoot.appendChild(rect);
<!-- Part Title-->
var mytext;
mytext = g_PO_SVGDoc.createElement("text");
mytext.setAttribute("x", nPinBodyX + nPinBodyWidth/2); //"215");
mytext.setAttribute("y", nPinBodyY - nPinHeight);
//mytext.setAttribute("style", "font-family:Verdana; font-weight:bold; font-size:12; fill:#000000");
mytext.setAttribute("style", "font-family:Verdana; font-weight:bold; font-size:12; fill:#000000; text-anchor: middle");
var sPartTitle = g_PO_sBaseDevice + " " + m_sPackageType;
var data = g_PO_SVGDoc.createTextNode(sPartTitle);
mytext.appendChild(data);
g_PO_SVGRoot.appendChild(mytext);
}
/**************************************************************************
* PO_CreatePinBody4
* PO_CreatePinBody4
*
****************************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?