|
@@ -58,16 +58,24 @@ public class LaserMeterToDxfUtil {
|
|
JSONObject jsonObject = (JSONObject) (obj);
|
|
JSONObject jsonObject = (JSONObject) (obj);
|
|
JSONArray points = jsonObject.getJSONArray("points");
|
|
JSONArray points = jsonObject.getJSONArray("points");
|
|
String type = jsonObject.getString("type");
|
|
String type = jsonObject.getString("type");
|
|
- if(type.contains("AREA")){
|
|
|
|
|
|
+ if(type.contains("AREA") || type.contains("RECTANGLE")){
|
|
for (int i = 0 ;i < points.size();i ++){
|
|
for (int i = 0 ;i < points.size();i ++){
|
|
JSONObject point1 = (JSONObject) points.get(i);
|
|
JSONObject point1 = (JSONObject) points.get(i);
|
|
JSONObject point2 = (JSONObject) points.get( i+1 >= points.size()? 0 :i+1 );
|
|
JSONObject point2 = (JSONObject) points.get( i+1 >= points.size()? 0 :i+1 );
|
|
drawLine(point1,point2,pointSet,dxfDocWriter);
|
|
drawLine(point1,point2,pointSet,dxfDocWriter);
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
- if(type.equals("LINE")){
|
|
|
|
|
|
+ if(type.contains("SERIES") ){
|
|
|
|
+ for (int i = 0 ;i < points.size();i ++){
|
|
|
|
+ if(i+1 >= points.size()){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ JSONObject point1 = (JSONObject) points.get(i);
|
|
|
|
+ JSONObject point2 = (JSONObject) points.get( i+1 >= points.size()? 0 :i+1 );
|
|
|
|
+ drawLine(point1,point2,pointSet,dxfDocWriter);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(type.contains("LINE") ){
|
|
JSONObject point1 = (JSONObject) (points.get(0));
|
|
JSONObject point1 = (JSONObject) (points.get(0));
|
|
JSONObject point2 = (JSONObject) (points.get(1));
|
|
JSONObject point2 = (JSONObject) (points.get(1));
|
|
drawLine(point1,point2,pointSet,dxfDocWriter);
|
|
drawLine(point1,point2,pointSet,dxfDocWriter);
|
|
@@ -153,7 +161,7 @@ public class LaserMeterToDxfUtil {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception{
|
|
public static void main(String[] args) throws Exception{
|
|
- String inPath ="D:\\cad\\work\\111\\6.json";
|
|
|
|
|
|
+ String inPath ="D:\\cad\\work\\111\\1.json";
|
|
String outPath ="D:\\cad\\work\\111\\"+new Date().getTime()+".dxf";
|
|
String outPath ="D:\\cad\\work\\111\\"+new Date().getTime()+".dxf";
|
|
LaserMeterToDxfUtil.toDxf(new File(inPath),outPath);
|
|
LaserMeterToDxfUtil.toDxf(new File(inPath),outPath);
|
|
}
|
|
}
|