102 lines
2.6 KiB
Go
102 lines
2.6 KiB
Go
package producer
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"os"
|
|
)
|
|
|
|
type Params struct {
|
|
PanRawFile string
|
|
MssRawFile string
|
|
AuxRawFile string
|
|
SaveRegisteredMssRaw bool
|
|
DoPansharpen bool
|
|
OutputDir string
|
|
PanTiffFile string
|
|
MssTiffFile string
|
|
FusTIffFile string
|
|
SubScenes bool
|
|
ReportFile string
|
|
DataId string
|
|
}
|
|
|
|
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
|
|
}
|