Commit 553ab5f3 by jiang'yun

修改

parent ddf45ac5
...@@ -233,6 +233,12 @@ ...@@ -233,6 +233,12 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.github.thecoldwine</groupId>
<artifactId>sigrun</artifactId>
<version>0.4.5</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -36,7 +36,8 @@ public class MimeTypeUtils ...@@ -36,7 +36,8 @@ public class MimeTypeUtils
// 视频格式 // 视频格式
"mp4", "avi", "rmvb", "mp4", "avi", "rmvb",
// pdf // pdf
"pdf" }; "pdf",
"sgy","segy" };
public static String getExtension(String prefix) public static String getExtension(String prefix)
{ {
......
package com.ruoyi.project.dz;
import com.github.thecoldwine.sigrun.common.*;
import com.github.thecoldwine.sigrun.serialization.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.Set;
public class SampleReadRoutine {
private static final Logger logger = LoggerFactory.getLogger(SampleReadRoutine.class.getName());
private static ParseProgressListener makeListener() {
return new ParseProgressListener() {
@Override
public void progress(long read) {
System.out.println("Progress changed to: " + read);
}
};
}
private static Set<ParseProgressListener> makeListenerSet() {
Set<ParseProgressListener> result = new HashSet<ParseProgressListener>();
result.add(makeListener());
return result;
}
public static BinaryHeaderFormat makeBinHeaderFormat() {
return BinaryHeaderFormatBuilder.aBinaryHeaderFormat()
.withLineNumberFormat(FormatEntry.create(4, 8))
.withSampleIntervalFormat(FormatEntry.create(16, 18))
.withSamplesPerDataTraceFormat(FormatEntry.create(20, 22))
.withDataSampleCodeFormat(FormatEntry.create(24, 26))
.withSegyFormatRevNumberFormat(FormatEntry.create(300, 302))
.withFixedLengthTraceFlagFormat(FormatEntry.create(302, 304))
.withNumberOf3200ByteFormat(FormatEntry.create(304, 306))
.build();
}
public static TraceHeaderFormat makeTraceHeaderFormat() {
return TraceHeaderFormatBuilder.aTraceHeaderFormat().
withEnsembleNumberFormat(FormatEntry.create(20, 24)).
withSourceXFormat(FormatEntry.create(72, 76)).
withSourceYFormat(FormatEntry.create(76, 80)).
withXOfCDPPositionFormat(FormatEntry.create(180, 184)).
withYOfCDPPositionFormat(FormatEntry.create(184, 188)).
withNumberOfSamplesFormat(FormatEntry.create(114, 116)).
build();
}
private static String tempPath = "D:\\qianhe\\file\\地震\\segy对比图\\line603_out_new_20250508.segy";
public static void main(String[] args) {
String path = tempPath;
if (path == null || path.isEmpty()) {
logger.error("Path is empty. Aborting");
System.exit(1);
}
logger.info(path);
try {
// Getting FileChannel for file.
FileChannel chan = new FileInputStream(path).getChannel();
// Create factory for particular SegY format
SEGYStreamFactory streamFactory = SEGYStreamFactory.create(
Charset.forName("Cp1047"),
makeBinHeaderFormat(),
makeTraceHeaderFormat());
final long startTime = System.currentTimeMillis();
// At this point reading actually started. EBCDIC and binary headers are parsed on
// object construction.
SEGYStream segyStream = streamFactory.makeStream(chan, makeListenerSet());
//
printTextHeader(segyStream.getTextHeader());
printBinHeaderInfo(segyStream.getBinaryHeader());
// Iterates over SegyFile. Stream is forward only and may be iterated only once.+
int i=1;
for (SeismicTrace trace : segyStream) {
if(i==1){
printTraceInfo(trace);
}
}
System.out.println(i);
final long timeEnd = System.currentTimeMillis() - startTime;
} catch (FileNotFoundException e) {
logger.error(e.getLocalizedMessage());
System.exit(2);
}
System.exit(0);
}
private static void printTextHeader(TextHeader header) {
System.out.println("Text Header info...");
for (String s : header.getContents()) {
System.out.println(s);
}
}
private static void printBinHeaderInfo(BinaryHeader binaryHeader) {
System.out.println("Binary Header info...");
System.out.println("Data sample code:" + binaryHeader.getDataSampleCode());
}
private static void printTraceInfo(SeismicTrace trace) {
System.out.println("Trace Header info...");
System.out.println("Number of samples: " + trace.getHeader().getNumberOfSamples());
System.out.println("Size of array: " + trace.getValues().length);
for(int i=0;i<trace.getValues().length;i++){
System.out.println(trace.getValues()[i]);
}
System.out.printf("Values: %.10f : %.10f%n", trace.getMin(), trace.getMax());
}
}
\ No newline at end of file
package com.ruoyi.project.dz.utils;
public class ByteUtil {
/**
* 转换short为byte
*
*/
public static Byte[] putShort(short s) {
Byte[] b =new Byte[2];;
b[1] = (byte) (s >> 8);
b[0] = (byte) (s >> 0);
return b;
}
/**
* 通过byte数组取到short
*
* @param b
* @param index
* 第⼏位开始取
* @return
*/
public static short getShort(byte[] b, int index) {
return (short) (((b[index + 1] << 8) | b[index + 0] & 0xff));
}
/**
* 转换int为byte数组
*
*/
public static Byte[] putInt(int x) {
Byte[] bb =new Byte[4];
bb[ 3] = (byte) (x >> 24);
bb[2] = (byte) (x >> 16);
bb[1] = (byte) (x >> 8);
bb[0] = (byte) (x >> 0);
return bb;
}
/**
* 通过byte数组取到int
*
* @param bb
* @param index
* 第⼏位开始
* @return
*/
public static int getInt(byte[] bb, int index) {
return (int) ((((bb[index + 3] & 0xff) << 24)
| ((bb[index + 2] & 0xff) << 16)
| ((bb[index + 1] & 0xff) << 8) | ((bb[index + 0] & 0xff) << 0))); }
/**
* 转换long型为byte数组
*
* @param bb
* @param x
* @param index
*/
public static void putLong(byte[] bb, long x, int index) {
bb[index + 7] = (byte) (x >> 56);
bb[index + 6] = (byte) (x >> 48);
bb[index + 5] = (byte) (x >> 40);
bb[index + 4] = (byte) (x >> 32);
bb[index + 3] = (byte) (x >> 24);
bb[index + 2] = (byte) (x >> 16);
bb[index + 1] = (byte) (x >> 8);
bb[index + 0] = (byte) (x >> 0);
}
/**
* 通过byte数组取到long
*
* @param bb
* @param index
* @return
*/
public static long getLong(byte[] bb, int index) {
return ((((long) bb[index + 7] & 0xff) << 56)
| (((long) bb[index + 6] & 0xff) << 48)
| (((long) bb[index + 5] & 0xff) << 40)
| (((long) bb[index + 4] & 0xff) << 32)
| (((long) bb[index + 3] & 0xff) << 24)
| (((long) bb[index + 2] & 0xff) << 16)
| (((long) bb[index + 1] & 0xff) << 8) | (((long) bb[index + 0] & 0xff) << 0)); }
/**
* 字符到字节转换
*
* @param ch
* @return
*/
public static void putChar(byte[] bb, char ch, int index) {
int temp = (int) ch;
// byte[] b = new byte[2];
for (int i = 0; i < 2; i ++ ) {
bb[index + i] = new Integer(temp & 0xff).byteValue(); // 将最⾼位保存在最低位temp = temp >> 8; // 向右移8位
}
}
/**
* 字节到字符转换
*
* @param b
* @return
*/
public static char getChar(byte[] b, int index) {
int s = 0;
if (b[index + 1] > 0)
s += b[index + 1];
else
s += 256 + b[index + 0];
s *= 256;
if (b[index + 0] > 0)
s += b[index + 1];
else
s += 256 + b[index + 0];
char ch = (char) s;
return ch;
}
/**
* float转换byte
*
* @param bb
* @param x
* @param index
*/
public static void putFloat(byte[] bb, float x, int index) { // byte[] b = new byte[4];
int l = Float.floatToIntBits(x);
for (int i = 0; i < 4; i++) {
bb[index + i] = new Integer(l).byteValue();
l = l >> 8;
}
}
/**
* 通过byte数组取得float
*
* @param bb
* @param index
* @return
*/
public static float getFloat(byte[] b, int index) {
int l;
l = b[index + 0];
l &= 0xff;
l |= ((long) b[index + 1] << 8);
l &= 0xffff;
l |= ((long) b[index + 2] << 16);
l &= 0xffffff;
l |= ((long) b[index + 3] << 24);
return Float.intBitsToFloat(l);
}
/**
* double转换byte
*
* @param bb
* @param x
* @param index
*/
public static void putDouble(byte[] bb, double x, int index) { // byte[] b = new byte[8];
long l = Double.doubleToLongBits(x);
for (int i = 0; i < 4; i++) {
bb[index + i] = new Long(l).byteValue();
l = l >> 8;
}
}
/**
* 通过byte数组取得float
*
* @param bb
* @param index
* @return
*/
public static double getDouble(byte[] b, int index) { long l;
l = b[0];
l &= 0xff;
l |= ((long) b[1] << 8);
l &= 0xffff;
l |= ((long) b[2] << 16);
l &= 0xffffff;
l |= ((long) b[3] << 24);
l &= 0xffffffffl;
l |= ((long) b[4] << 32);
l &= 0xffffffffffl;
l |= ((long) b[5] << 40);
l &= 0xffffffffffffl;
l |= ((long) b[6] << 48);
l &= 0xffffffffffffffl;
l |= ((long) b[7] << 56);
return Double.longBitsToDouble(l);
}
}
\ No newline at end of file
package com.ruoyi.project.dz.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class CodeUtil {
public static byte[] EToA = hexToBytes(getEDBToAsc());
public static byte[] AToE = hexToBytes(getAscToEDB());
public static String getAscToEDB() {
StringBuffer sb = new StringBuffer();
sb.append("00010203372D2E2F1605250B0C0D0E0F");
sb.append("101112133C3D322618193F271C1D1E1F");
sb.append("405A7F7B5B6C507D4D5D5C4E6B604B61");
sb.append("F0F1F2F3F4F5F6F7F8F97A5E4C7E6E6F");
sb.append("7CC1C2C3C4C5C6C7C8C9D1D2D3D4D5D6");
sb.append("D7D8D9E2E3E4E5E6E7E8E9ADE0BD5F6D");
sb.append("79818283848586878889919293949596");
sb.append("979899A2A3A4A5A6A7A8A9C04FD0A107");
sb.append("202122232415061728292A2B2C090A1B");
sb.append("30311A333435360838393A3B04143EE1");
sb.append("41424344454647484951525354555657");
sb.append("58596263646566676869707172737475");
sb.append("767778808A8B8C8D8E8F909A9B9C9D9E");
sb.append("9FA0AAABAC4AAEAFB0B1B2B3B4B5B6B7");
sb.append("B8B9BABBBC6ABEBFCACBCCCDCECFDAdB");
sb.append("DCDDDEDFEAEBECEDEEEFFAFBFCFDFEFF");
return sb.toString();
}
public static String getEDBToAsc() {
StringBuffer sb = new StringBuffer();
sb.append("000102039C09867F978D8E0B0C0D0E0F");
sb.append("101112139D8508871819928F1C1D1E1F");
sb.append("80818283840A171B88898A8B8C050607");
sb.append("909116939495960498999A9B14159E1A");
sb.append("20A0A1A2A3A4A5A6A7A8D52E3C282B7C");
sb.append("26A9AAABACADAEAFB0B121242A293B5E");
sb.append("2D2FB2B3B4B5B6B7B8B9E52C255F3E3F");
sb.append("BABBBCBDBEBFC0C1C2603A2340273D22");
sb.append("C3616263646566676869C4C5C6C7C8C9");
sb.append("CA6A6B6C6D6E6F707172CBCCCDCECFD0");
sb.append("D17E737475767778797AD2D3D45BD6D7");
sb.append("D8D9DADBDCDDDEDFE0E1E2E3E45DE6E7");
sb.append("7B414243444546474849E8E9EAEBECED");
sb.append("7D4A4B4C4D4E4F505152EEEFF0F1F2F3");
sb.append("5C9F535455565758595AF4F5F6F7F8F9");
sb.append("30313233343536373839FAFBFCFDFEFF");
return sb.toString();
}
public static byte[] hexToBytes(char[] hex) {
int length = hex.length / 2;
byte[] raw = new byte[length];
for (int i = 0; i < length; i++) {
int high = Character.digit(hex[i * 2], 16);
int low = Character.digit(hex[i * 2 + 1], 16);
int value = (high << 4) | low;
if (value > 127)
value -= 256;
raw[i] = (byte) value;
}
return raw;
}
public static byte[] hexToBytes(String hex) {
return hexToBytes(hex.toCharArray());
}
/**
* byte :: ASCII->EBCDIC
*/
public static int ASCIIToEBCDIC(int ascii) {
return AToE[ascii & 0xff] & 0xff;
}
/**
* byte :: EBCDIC->ASCII
*/
public static int EBCDICToASCII(int ebcdic) {
return EToA[ebcdic & 0xff] & 0xff;
}
/**
* byte[] :: ASCII->EBCDIC
*/
public static byte[] ASCIIToEBCDIC(byte[] ascii) {
byte[] tobytes = new byte[ascii.length];
for (int i = 0; i < ascii.length; i++)
tobytes[i] = (byte) ASCIIToEBCDIC(ascii[i]);
return tobytes;
}
/**
* byte[] :: EBCDIC->ASCII
*/
public static byte[] EBCDICToASCII(byte[] ebcdic) {
byte[] tobytes = new byte[ebcdic.length];
for (int i = 0; i < ebcdic.length; i++)
tobytes[i] = (byte) EBCDICToASCII(ebcdic[i]);
return tobytes;
}
/**
* String :: ASCII->EBCDIC
*/
public static String ASCIIToEBCDIC(String ascii) throws Exception {
return new String(ASCIIToEBCDIC(ascii.getBytes("iso-8859-1")),
"iso-8859-1");
}
/**
* String :: EBCDIC->ASCII
*/
public static String EBCDICToASCII(String ebcdic) throws Exception {
return new String(EBCDICToASCII(ebcdic.getBytes("iso-8859-1")),
"iso-8859-1");
}
/**
* File :: ASCII->EBCDIC
*/
public static void ASCIIToEBCDIC(String fromfile, String tofile) {
try {
FileInputStream in = new FileInputStream(new File(fromfile));
FileOutputStream out = new FileOutputStream(new File(tofile));
int tempint, i = 0;
byte[] tempbytes = new byte[in.available()];
while ((tempint = in.read()) != -1)
tempbytes[i++] = (byte) tempint;
out.write(ASCIIToEBCDIC(tempbytes));
in.close();
out.close();
} catch (Exception e) {
System.out.println(e);
}
}
/**
* File :: EBCDIC->ASCII
*/
public static void EBCDICToASCII(String fromfile, String tofile) {
try {
FileInputStream in = new FileInputStream(new File(fromfile));
FileOutputStream out = new FileOutputStream(new File(tofile));
int tempint, i = 0;
byte[] tempbytes = new byte[in.available()];
while ((tempint = in.read()) != -1)
tempbytes[i++] = (byte) tempint;
out.write(EBCDICToASCII(tempbytes));
in.close();
out.close();
} catch (Exception e) {
System.out.println(e);
}
}
/**
* @param args
*/
public static void main(String[] args) {
try {
String srcStr = "Y2I10000CIBF01 0000000006000000000000000000000 ?DP START?TEST ACCOUNT"
+ "000348 ?0000000009387.93+?0000000000000.00+?0000000000000.00"
+ "+?0000000000000.00+?00000000?00000000?0.00000000+?00000000?0000000009387.93+?000"
+ "0000009387.93+?00000000000.00+?00000000000.00+?0000000000000.00+?0000000000000.0"
+ "0+?0000000000000.00+?0000000000000.00+?0000000009387.93+?0000000000001.00+?00000"
+ "00000001.82+?0000000000000.00+?0000000000000.00+?0000000000000.00+?0000000000000"
+ ".00+?0000000000000.00+?0000000000000.00+?0000000000000.00+?0000000000000.00+?000"
+ "006?END";
String srcStr1 = "3èò????????????@@???????????????????????????????@j?×@@@@@@?????j????@???????@???ó??@@@@@@@@@@@@@@@@@@@@@j?????????ùó?÷KùóNj?????????????K??Nj?????????????K??Nj?????????????K??Nj????????j????????j?K????????Nj????????j?????????ùó?÷KùóNj?????????ùó?÷KùóNj???????????K??Nj???????????K??Nj?????????????K??Nj?????????????K??Nj?????????????K??Nj?????????????K??Nj?????????ùó?÷KùóNj?????????????K??Nj?????????????K?òNj?????????????K??Nj?????????????K??Nj?????????????K??Nj?????????????K??Nj?????????????K??Nj?????????????K??Nj?????????????K??Nj?????????????K??Nj??????j???";
String outStr = ASCIIToEBCDIC(srcStr);
System.out.println(outStr);
System.out.println(EBCDICToASCII(srcStr1));
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.ruoyi.project.dz.utils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* 获取两坐标之间的坐标点
* Created by wangjian on 2023/9/1.
*/
public class CoordinateUtil {
/**
* 依次传入两个点的XY坐标 返回两点之间的点列表
* */
public static List<Point> getPointBetweenTwo(int startX, int startY, int endX, int endY){
//目前可以处理 第二个点在第一个点右上、正右、正上、右下、
//不行的 正下、左下、正左、左上
//步骤1:获取起始坐标和结束坐标
// int startX = 10;
// int startY = 10;
// int endX = 10;
// int endY = 2;
//步骤2:计算两坐标之间的水平和垂直距离
int horizontalDistance = endX - startX;
int verticalDistance = endY - startY;
//步骤3:根据水平和垂直距离计算每一步的增量
//根据水平和垂直距离计算每一步的增量。增量可以通过将水平距离除以最大步数得到,
//同样地,垂直增量可以通过将垂直距离除以最大步数得到。为了简化,我们假设步数为10。
int maxSteps = horizontalDistance == 0 ? verticalDistance:horizontalDistance;//X轴坐标变化为0时,用Y计算
int abs_maxSteps = Math.abs(maxSteps);//绝对值 解决 第二个点在第一个点的 正下、左下、正左、左上 的情况
double horizontalIncrement = (double)horizontalDistance / abs_maxSteps;
double verticalIncrement = (double)verticalDistance / abs_maxSteps;
//步骤4:通过增量依次计算并输出每一个坐标点
List<Point> lp = new ArrayList<>();
for (int i = 0; i <= abs_maxSteps; i++) {
double currentX = startX + (i * horizontalIncrement);
double currentY = startY + (i * verticalIncrement);
Double bx = new BigDecimal(currentX).setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue();
Double by = new BigDecimal(currentY).setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue();
//System.out.println("坐标点 " + i + ": (" + bx + ", " + by + ")");
Point p = new Point();
p.setX(bx.intValue());
p.setY(by.intValue());
lp.add(p);
}
return lp;
}
}
package com.ruoyi.project.dz.utils;
/**
* Created by wangjian on 2023/9/4.
*/
public class Point {
private int x;
private int y;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
package com.ruoyi.project.dz.utils;
/**
* segy文件格式异常
* @author dingyi
*
*/
public class SegyFileFormatException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public SegyFileFormatException(String msg){
super(msg);
}
}
package com.ruoyi.project.dz.utils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.ArrayList;
/**
* 每个segy文件的卷头数据
* 对应2002年segy数据规范
*
*
* @author dingyi
*
*/
public class SegyTextFileHeader extends BaseEntity {
private ArrayList<String> txtHeader=new ArrayList<String>(40);
// C 3 First inline:855 Last inline:1228
int first_inline;//第一个纵向测线
int last_inline;//最后一个纵向测线
// C 4 First xline:187 Last xline:1026
int first_xline;//第一个横向测线
int last_xline;//最后一个横向测线
// C 5 xmin:14710960.00 xmax:14731940.00 inline spacing:25.00
Double xmin;//最小X坐标
Double xmax;//最大X坐标
Double inline_spacing;//纵向测线间隔
// C 6 ymin:4429512.00 ymax:14731940.00 inline spacing:25.00
Double ymin;//最小y坐标
Double ymax;//最大y坐标
Double inline_spacing_hx;//横向测线间隔
// C 7 Time min(ms):3590.00 max:3804.00 delta:0.25
// C 8
// C 9
// C10 Amplitude min:1.67 max:1.87
// C11 Trace sample format: IBM_FLOAT(1)
// C12 Coordinate scale factor:1
// C13
// C14 Binary header locations:
// C15 Sample interval : bytes 17-18
// C16 Number of samples per trace : bytes 21-22
// C17 Trace date format : bytes 25-26
// C18
// C19 Trace header locations:
// C20 Inline number : bytes 9-12
// C21 Xline number : bytes 21-24
// C22 Coordinate scale factor : bytes 71-72
// C23 X coordinate : bytes 73-76
// C24 Y coordinate : bytes 77-80
// C25 Trace start time/depth : bytes 109-110
// C26 Number of samples per trace : bytes 115-116
// C27 Sample interval : bytes 117-118
/**
* 根据读到的字节流构造卷头对象
* @param b 字节流
*/
public SegyTextFileHeader(byte[] b){
for(int i=0;i<40;i++){
StringBuffer sb=new StringBuffer(80);
for(int j=0;j<80;j++){
sb.append((char)b[i*80+j]);
}
txtHeader.add(i,sb.toString());
getInfo(sb.toString());
}
}
/**
* 判断卷头数据是否有效
* 依据2002年segy数据规范
* 判断依据:每一行均以大写C开头
* @return
*/
public boolean isValid(){
for(String s:txtHeader){
if(!s.startsWith("C"))
return false;
}
return true;
}
public void getInfo(String str){
if (StringUtils.isNotEmpty(str) && str.length() > 4 && str.startsWith("C 3 ")) {
String s2 = str.substring(4, str.length()); //去掉 "C 1 " 这些开头
String param_name_1 = s2.substring(0, s2.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_1 = s2.substring(s2.indexOf(":") + 1, s2.indexOf(" ", s2.indexOf(":")));//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_1 + " : " + param_value_1);
first_inline = Integer.valueOf(param_value_1);
//第二个参数
String s3 = s2.substring(s2.indexOf(" ", s2.indexOf(":")) + 1, s2.length());//第一个:之后第一个空格的位置 往后开始截取
s3 = s3.trim();
String param_name_2 = s3.substring(0, s3.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_2 = s3.substring(s3.indexOf(":") + 1, s3.length());//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_2 + " : " + param_value_2);
last_inline = Integer.valueOf(param_value_2);
}
if (StringUtils.isNotEmpty(str) && str.length() > 4 && str.startsWith("C 4 ")) {
String s2 = str.substring(4, str.length()); //去掉 "C 1 " 这些开头
String param_name_1 = s2.substring(0, s2.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_1 = s2.substring(s2.indexOf(":") + 1, s2.indexOf(" ", s2.indexOf(":")));//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_1 + " : " + param_value_1);
first_xline = Integer.valueOf(param_value_1);
//第二个参数
String s3 = s2.substring(s2.indexOf(" ", s2.indexOf(":")) + 1, s2.length());//第一个:之后第一个空格的位置 往后开始截取
s3 = s3.trim();
String param_name_2 = s3.substring(0, s3.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_2 = s3.substring(s3.indexOf(":") + 1, s3.length());//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_2 + " : " + param_value_2);
last_xline = Integer.valueOf(param_value_2);
}
if (StringUtils.isNotEmpty(str) && str.length() > 4 && str.startsWith("C 5 ")) {
String s2 = str.substring(4, str.length()); //去掉 "C 1 " 这些开头
String param_name_1 = s2.substring(0, s2.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_1 = s2.substring(s2.indexOf(":") + 1, s2.indexOf(" ", s2.indexOf(":")));//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_1 + " : " + param_value_1);
xmin = Double.valueOf(param_value_1);
//第二个参数
String s3 = s2.substring(s2.indexOf(" ", s2.indexOf(":")) + 1, s2.length());//第一个:之后第一个空格的位置 往后开始截取
s3 = s3.trim();
String param_name_2 = s3.substring(0, s3.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_2 = s3.substring(s3.indexOf(":") + 1, s3.indexOf(" ", s3.indexOf(":")));//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_2 + " : " + param_value_2);
xmax = Double.valueOf(param_value_2);
//第三个参数
String s4 = s3.substring(s3.indexOf(" ", s3.indexOf(":")) + 1, s3.length());//第一个:之后第一个空格的位置 往后开始截取
s4 = s4.trim();
String param_name_3 = s4.substring(0, s4.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_3 = s4.substring(s4.indexOf(":") + 1, s4.length());//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_3 + " : " + param_value_3);
inline_spacing = Double.valueOf(param_value_3);
}
if (StringUtils.isNotEmpty(str) && str.length() > 4 && str.startsWith("C 6 ")) {
String s2 = str.substring(4, str.length()); //去掉 "C 1 " 这些开头
String param_name_1 = s2.substring(0, s2.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_1 = s2.substring(s2.indexOf(":") + 1, s2.indexOf(" ", s2.indexOf(":")));//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_1 + " : " + param_value_1);
ymin = Double.valueOf(param_value_1);
//第二个参数
String s3 = s2.substring(s2.indexOf(" ", s2.indexOf(":")) + 1, s2.length());//第一个:之后第一个空格的位置 往后开始截取
s3 = s3.trim();
String param_name_2 = s3.substring(0, s3.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_2 = s3.substring(s3.indexOf(":") + 1, s3.indexOf(" ", s3.indexOf(":")));//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_2 + " : " + param_value_2);
ymax = Double.valueOf(param_value_2);
//第三个参数
String s4 = s3.substring(s3.indexOf(" ", s3.indexOf(":")) + 1, s3.length());//第一个:之后第一个空格的位置 往后开始截取
s4 = s4.trim();
String param_name_3 = s4.substring(0, s4.indexOf(":"));//获取一个属性名称 : 前的内容
String param_value_3 = s4.substring(s4.indexOf(":") + 1, s4.length());//之后到空格前的内容
System.out.println(" 读取内容 " + param_name_3 + " : " + param_value_3);
inline_spacing_hx = Double.valueOf(param_value_3);
}
}
public int getFirst_inline() {
return first_inline;
}
public void setFirst_inline(int first_inline) {
this.first_inline = first_inline;
}
public int getLast_inline() {
return last_inline;
}
public void setLast_inline(int last_inline) {
this.last_inline = last_inline;
}
public int getFirst_xline() {
return first_xline;
}
public void setFirst_xline(int first_xline) {
this.first_xline = first_xline;
}
public int getLast_xline() {
return last_xline;
}
public void setLast_xline(int last_xline) {
this.last_xline = last_xline;
}
public Double getXmin() {
return xmin;
}
public void setXmin(Double xmin) {
this.xmin = xmin;
}
public Double getXmax() {
return xmax;
}
public void setXmax(Double xmax) {
this.xmax = xmax;
}
public Double getInline_spacing() {
return inline_spacing;
}
public void setInline_spacing(Double inline_spacing) {
this.inline_spacing = inline_spacing;
}
public Double getYmin() {
return ymin;
}
public void setYmin(Double ymin) {
this.ymin = ymin;
}
public Double getYmax() {
return ymax;
}
public void setYmax(Double ymax) {
this.ymax = ymax;
}
public Double getInline_spacing_hx() {
return inline_spacing_hx;
}
public void setInline_spacing_hx(Double inline_spacing_hx) {
this.inline_spacing_hx = inline_spacing_hx;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment