操作:locateFacility のソースリスト public static function locateFacility(argObj:Object): SG_Point { gittok では Object の連想配列列で引数を与える. // facility location applying weighted mean var attValues:ArrayList = argObj["surfaces"] as ArrayList; var surfaces:ArrayList = new ArrayList(); var m:int = attValues.length; for (var i:int = 0; i < m; i++) { var attList:ArrayList = attValues.getItemAt(i) as ArrayList; surfaces.addAll(attList); 住宅宅の形状のリスト } attValues = argObj["stories"] as ArrayList; var stories:ArrayList = new ArrayList(); m = attValues.length; for (i = 0; i < m; i++) { attList = attValues.getItemAt(i) as ArrayList; stories.addItem(attList.getItemAt(0) as Integer); 住宅宅の階数のリスト } m = surfaces.length; ⾯面(住宅宅)の数 var sumNumeratorX:Number = 0; var sumNumeratorY:Number = 0; var sumDenominator:Number = 0; for (i = 0; i < m; i++) { var s:SG_Surface = surfaces.getItemAt(i) as SG_Surface; var exterior:SG_Ring = s.exterior; var polygon:CoordinateArray = exterior.coordinateSequence(); // storey (story in Am) is defined as a level of building. var storey:Integer = stories.getItemAt(i) as Integer; var area:Number = math.Area.getSimpleArea(polygon) * storey.value; 外周の⾯面積に階数を掛けて,総床⾯面積を求める. var weight:Number = area; var weight2:Number = weight * weight; 住宅宅の総床⾯面積の⼆二乗が重みになる. attList = new ArrayList(); attList.addItem(surfaces.getItemAt(i)); attValues = new ArrayList(); attValues.addItem(attList); argObj = new Object(); argObj["surface"] = attValues; var sPos:SG_Point = centerOfMIC(argObj); 住宅宅の外周の最⼤大内接円中⼼心を求める. sumNumeratorX += weight2 * sPos.position.x; 重み付きの総和(x 座標) sumNumeratorY += weight2 * sPos.position.y; 重み付きの総和(y 座標) sumDenominator += weight2; 重みの総和(分⺟母) } var cPos:SG_Point = new SG_Point(); cPos.position.x = sumNumeratorX / sumDenominator; 重み付き平均(x 座標) cPos.position.y = sumNumeratorY / sumDenominator; 重み付き平均(y 座標) return cPos; 戻り値(コンビニの位置) }
© Copyright 2024 ExpyDoc