支持xml入参
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"image"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/mat"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"image"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Params struct {
|
||||
PanRawFile string
|
||||
@@ -12,3 +17,83 @@ type Params struct {
|
||||
FusTIffFile string
|
||||
SubScenes bool
|
||||
}
|
||||
|
||||
type XMLImageTask struct {
|
||||
XMLName xml.Name `xml:"task"`
|
||||
Name string `xml:"name,attr"`
|
||||
ID string `xml:"id,attr"`
|
||||
Script string `xml:"script"`
|
||||
InputFileList XMLInputFileList `xml:"inputfilelist"`
|
||||
Params XMLParams `xml:"params"`
|
||||
}
|
||||
|
||||
type XMLInputFileList struct {
|
||||
PanData string `xml:"panData"`
|
||||
MssData string `xml:"mssData"`
|
||||
AuxData string `xml:"auxData"`
|
||||
}
|
||||
|
||||
type XMLParams struct {
|
||||
Satellite string `xml:"satellite"`
|
||||
Sensor string `xml:"sensor"`
|
||||
ProductLevel string `xml:"productLevel"`
|
||||
ProductID string `xml:"productId"`
|
||||
TempPath string `xml:"tempPath"`
|
||||
OutputPath string `xml:"outputPath"`
|
||||
DeleteTempFlag int `xml:"deleteTempFlag"`
|
||||
ReportFile string `xml:"reportFile"`
|
||||
DataID string `xml:"dataId"`
|
||||
DoPansharpen bool `xml:"doPansharpen"`
|
||||
}
|
||||
|
||||
func ParseXMLImageTask(xmlFile string) (*XMLImageTask, error) {
|
||||
var task XMLImageTask
|
||||
data, err := os.ReadFile(xmlFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = xml.Unmarshal(data, &task)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &task, nil
|
||||
}
|
||||
|
||||
type XMLFUSTask struct {
|
||||
XMLName xml.Name `xml:"task"`
|
||||
Name string `xml:"name,attr"`
|
||||
ID string `xml:"id,attr"`
|
||||
Script string `xml:"script"`
|
||||
InputFileList XMLFUSInputFileList `xml:"inputfilelist"`
|
||||
Params XMLFUSParams `xml:"params"`
|
||||
}
|
||||
|
||||
type XMLFUSInputFileList struct {
|
||||
PanTiff string `xml:"panTiff"`
|
||||
MssTiff string `xml:"mssTiff"`
|
||||
}
|
||||
|
||||
type XMLFUSParams struct {
|
||||
Satellite string `xml:"satellite"`
|
||||
Sensor string `xml:"sensor"`
|
||||
ProductLevel string `xml:"productLevel"`
|
||||
ProductID string `xml:"productId"`
|
||||
TempPath string `xml:"tempPath"`
|
||||
OutputPath string `xml:"outputPath"`
|
||||
DeleteTempFlag int `xml:"deleteTempFlag"`
|
||||
ReportFile string `xml:"reportFile"`
|
||||
DataID string `xml:"dataId"`
|
||||
}
|
||||
|
||||
func ParseXMLFUSTask(xmlFile string) (*XMLFUSTask, error) {
|
||||
var task XMLFUSTask
|
||||
data, err := os.ReadFile(xmlFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = xml.Unmarshal(data, &task)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &task, nil
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"image"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import "fmt"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
@@ -11,7 +11,7 @@ type Report struct {
|
||||
Satellite string `xml:"satellite,attr"`
|
||||
Sensor string `xml:"sensor,attr"`
|
||||
ProductLevel string `xml:"productLevel,attr"`
|
||||
Scenes []ReportScene `xml:"scene"`
|
||||
Scenes []ReportScene `xml:"scenes>scene"`
|
||||
}
|
||||
|
||||
// Scene represents each scene in the report
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package imageproc
|
||||
package producer
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
Reference in New Issue
Block a user