Compare commits
3 Commits
966e848f50
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ac96d180a | |||
| 7c97421dc2 | |||
| ab8ce69b3e |
@@ -1,7 +0,0 @@
|
|||||||
# cavepedia
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- go 1.16+
|
|
||||||
- konvajs 7.2.5
|
|
||||||
- survex img.{c,h} 1.2.45
|
|
||||||
16
launch.sh
16
launch.sh
@@ -5,23 +5,15 @@ set -e
|
|||||||
build () {
|
build () {
|
||||||
pushd ./src &>/dev/null
|
pushd ./src &>/dev/null
|
||||||
|
|
||||||
# go get honnef.co/go/tools/cmd/staticcheck
|
go get honnef.co/go/tools/cmd/staticcheck
|
||||||
go mod tidy
|
go get github.com/zserge/lorca
|
||||||
|
|
||||||
gofmt -w .
|
gofmt -w .
|
||||||
# staticcheck .
|
staticcheck .
|
||||||
CGO_ENABLED=1 go build -o ./kavea -v .
|
CGO_ENABLED=1 GOARCH=amd64 go build -o ./kavea_linux_amd64 -v .
|
||||||
|
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
run () {
|
|
||||||
./src/kavea
|
|
||||||
}
|
|
||||||
|
|
||||||
release () {
|
|
||||||
build
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$@
|
$@
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ func checkError(err error) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HTTP */
|
|
||||||
func checkWebError(w http.ResponseWriter, err error) bool {
|
func checkWebError(w http.ResponseWriter, err error) bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
@@ -21,11 +20,3 @@ func checkWebError(w http.ResponseWriter, err error) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
//func getURLParam(r *http.Request, param string) string {
|
|
||||||
// paramList, exists := r.URL.Query()[param]
|
|
||||||
// if !exists {
|
|
||||||
// return ""
|
|
||||||
// }
|
|
||||||
// return paramList[0]
|
|
||||||
//}
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ module git.seaturtle.pw/pew/kavea
|
|||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/google/renameio v0.1.0 // indirect
|
||||||
|
github.com/kisielk/gotool v1.0.0 // indirect
|
||||||
|
github.com/rogpeppe/go-internal v1.3.0 // indirect
|
||||||
github.com/zserge/lorca v0.1.10
|
github.com/zserge/lorca v0.1.10
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
|
honnef.co/go/tools v0.2.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
31
src/go.sum
31
src/go.sum
@@ -1,14 +1,45 @@
|
|||||||
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/zserge/lorca v0.1.10 h1:f/xBJ3D3ipcVRCcvN8XqZnpoKcOXV8I4vwqlFyw7ruc=
|
github.com/zserge/lorca v0.1.10 h1:f/xBJ3D3ipcVRCcvN8XqZnpoKcOXV8I4vwqlFyw7ruc=
|
||||||
github.com/zserge/lorca v0.1.10/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A=
|
github.com/zserge/lorca v0.1.10/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||||
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
|
||||||
|
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
|
||||||
|
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
|
||||||
|
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
|
honnef.co/go/tools v0.2.1 h1:/EPr//+UMMXwMTkXvCCoaJDq8cpjMO80Ou+L4PDo2mY=
|
||||||
|
honnef.co/go/tools v0.2.1/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
|
||||||
|
|||||||
66
src/img.go
Normal file
66
src/img.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo LDFLAGS: -lm
|
||||||
|
#include "img.h"
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
// "encoding/json"
|
||||||
|
// "fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var pimg *C.img
|
||||||
|
|
||||||
|
type img struct {
|
||||||
|
ImgReadCode int `json:"imgReadCode"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
MvX float64 `json:"mv_x"`
|
||||||
|
MvY float64 `json:"mv_y"`
|
||||||
|
MvZ float64 `json:"mv_z"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func ImgOpen(filename string) interface{} {
|
||||||
|
pimg = C.img_open_survey(C.CString(filename), nil)
|
||||||
|
// fmt.Println(C.GoFloat64(pimg.mv.x))
|
||||||
|
|
||||||
|
if pimg.title == nil {
|
||||||
|
return img{
|
||||||
|
ImgReadCode: 0,
|
||||||
|
Title: "NULL",
|
||||||
|
MvX: float64(pimg.mv.x),
|
||||||
|
MvY: float64(pimg.mv.y),
|
||||||
|
MvZ: float64(pimg.mv.z),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return img{
|
||||||
|
ImgReadCode: 0,
|
||||||
|
Title: C.GoString(pimg.title),
|
||||||
|
MvX: float64(pimg.mv.x),
|
||||||
|
MvY: float64(pimg.mv.y),
|
||||||
|
MvZ: float64(pimg.mv.z),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ImgReadItem() img {
|
||||||
|
img_read_code := C.img_read_item(pimg, &pimg.mv)
|
||||||
|
|
||||||
|
if pimg.title == nil {
|
||||||
|
return img{
|
||||||
|
ImgReadCode: int(img_read_code),
|
||||||
|
Title: "NULL",
|
||||||
|
MvX: float64(pimg.mv.x),
|
||||||
|
MvY: float64(pimg.mv.y),
|
||||||
|
MvZ: float64(pimg.mv.z),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return img{
|
||||||
|
ImgReadCode: int(img_read_code),
|
||||||
|
Title: C.GoString(pimg.title),
|
||||||
|
MvX: float64(pimg.mv.x),
|
||||||
|
MvY: float64(pimg.mv.y),
|
||||||
|
MvZ: float64(pimg.mv.z),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/kavea_linux_amd64
Executable file
BIN
src/kavea_linux_amd64
Executable file
Binary file not shown.
11
src/main.go
11
src/main.go
@@ -20,11 +20,11 @@ func main() {
|
|||||||
|
|
||||||
/* Web Server */
|
/* Web Server */
|
||||||
http.Handle("/static/", http.FileServer(http.FS(staticFiles)))
|
http.Handle("/static/", http.FileServer(http.FS(staticFiles)))
|
||||||
http.Handle("/favicon.ico", http.RedirectHandler("/static/favicon.ico", http.StatusMovedPermanently))
|
http.HandleFunc("/", GetHome) // Redirects to /search if auth'd
|
||||||
http.HandleFunc("/", GetHome)
|
|
||||||
|
|
||||||
// Start in separate goroutine
|
/* Start Web Server */
|
||||||
go func() {
|
go func() {
|
||||||
|
log.Println("Server is running!")
|
||||||
log.Fatal(http.ListenAndServe(":3000", nil))
|
log.Fatal(http.ListenAndServe(":3000", nil))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -37,6 +37,11 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* IMG */
|
||||||
|
ui.Bind("img_open", ImgOpen)
|
||||||
|
ui.Bind("img_read_item", ImgReadItem)
|
||||||
|
|
||||||
defer ui.Close()
|
defer ui.Close()
|
||||||
<-ui.Done()
|
<-ui.Done()
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/static/babylon-4.2.0.gui.min.js
vendored
Normal file
16
src/static/babylon-4.2.0.gui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
src/static/babylon-4.2.0.js
Normal file
16
src/static/babylon-4.2.0.js
Normal file
File diff suppressed because one or more lines are too long
16
src/static/babylonjs-4.2.0.loaders.min.js
vendored
Normal file
16
src/static/babylonjs-4.2.0.loaders.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,32 +0,0 @@
|
|||||||
var stage = new Konva.Stage({
|
|
||||||
container: 'container',
|
|
||||||
width: window.innerWidth,
|
|
||||||
height: window.innerHeight,
|
|
||||||
});
|
|
||||||
|
|
||||||
// add canvas element
|
|
||||||
var layer = new Konva.Layer();
|
|
||||||
stage.add(layer);
|
|
||||||
|
|
||||||
// create shape
|
|
||||||
var box = new Konva.Rect({
|
|
||||||
x: 50,
|
|
||||||
y: 50,
|
|
||||||
width: 100,
|
|
||||||
height: 50,
|
|
||||||
fill: '#00D2FF',
|
|
||||||
stroke: 'black',
|
|
||||||
strokeWidth: 4,
|
|
||||||
draggable: true,
|
|
||||||
});
|
|
||||||
layer.add(box);
|
|
||||||
|
|
||||||
layer.draw();
|
|
||||||
|
|
||||||
// add cursor styling
|
|
||||||
box.on('mouseover', function () {
|
|
||||||
document.body.style.cursor = 'pointer';
|
|
||||||
});
|
|
||||||
box.on('mouseout', function () {
|
|
||||||
document.body.style.cursor = 'default';
|
|
||||||
});
|
|
||||||
12
src/static/js/konva.7.2.5.min.js
vendored
12
src/static/js/konva.7.2.5.min.js
vendored
File diff suppressed because one or more lines are too long
13
src/static/kavea.css
Normal file
13
src/static/kavea.css
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
html, body {
|
||||||
|
overflow: hidden;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#renderCanvas {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
51
src/static/kavea.js
Normal file
51
src/static/kavea.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
const canvas = document.getElementById("renderCanvas"); // Get the canvas element
|
||||||
|
const engine = new BABYLON.Engine(canvas, true); // Generate the BABYLON 3D engine
|
||||||
|
|
||||||
|
// Add your code here matching the playground format
|
||||||
|
const createScene = function () {
|
||||||
|
|
||||||
|
const scene = new BABYLON.Scene(engine);
|
||||||
|
|
||||||
|
BABYLON.SceneLoader.ImportMeshAsync("", "https://assets.babylonjs.com/meshes/", "box.babylon");
|
||||||
|
|
||||||
|
const camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 15, new BABYLON.Vector3(0, 0, 0));
|
||||||
|
camera.attachControl(canvas, true);
|
||||||
|
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0));
|
||||||
|
|
||||||
|
return scene;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const scene = createScene(); //Call the createScene function
|
||||||
|
|
||||||
|
// Register a render loop to repeatedly render the scene
|
||||||
|
engine.runRenderLoop(function () {
|
||||||
|
scene.render();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Watch for browser/canvas resize events
|
||||||
|
window.addEventListener("resize", function () {
|
||||||
|
engine.resize();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/* IMG */
|
||||||
|
let pimg = img_open('Skydusky.3d')
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
|
pimg = img_read_item()
|
||||||
|
pimg.then(o => console.log(o.label))
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Kavea</title>
|
<title>kavea</title>
|
||||||
|
<link rel="stylesheet" href="/static/kavea.css">
|
||||||
|
<script src="/static/babylon-4.2.0.js"></script>
|
||||||
|
<script src="/static/babylonjs-4.2.0.loaders.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container"></div>
|
<canvas id="renderCanvas"></canvas>
|
||||||
|
<script src="/static/kavea.js"></script>
|
||||||
<script src="/static/js/konva.7.2.5.min.js"></script>
|
|
||||||
<script src="/static/js/kavea.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
29
src/web.go
29
src/web.go
@@ -1,31 +1,16 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// #cgo LDFLAGS: -lm
|
|
||||||
// #include "img.h"
|
|
||||||
import "C"
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"html/template"
|
||||||
// "html/template"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetHome(w http.ResponseWriter, r *http.Request) {
|
func GetHome(w http.ResponseWriter, r *http.Request) {
|
||||||
filename := C.CString("Skydusky.3d")
|
t, err := template.ParseFS(templatesHTML, "templates/index.html.tmpl")
|
||||||
img := C.img_open_survey(filename, nil)
|
if !checkWebError(w, err) {
|
||||||
for true {
|
return
|
||||||
p := C.img_point{}
|
|
||||||
C.img_read_item(img, &p)
|
|
||||||
fmt.Printf(C.GoString(img.label))
|
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// // return index.html
|
err = t.Execute(w, nil)
|
||||||
// t, err := template.ParseFS(templatesHTML, "templates/index.html.tmpl")
|
checkError(err)
|
||||||
// if !checkWebError(w, err) {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// err = t.Execute(w, nil)
|
|
||||||
// if !checkError(err) {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user