Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UFrameIT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FrameIT
UFrameIT
Commits
9ea37b3e
Commit
9ea37b3e
authored
4 years ago
by
Richard Marcus
Browse files
Options
Downloads
Patches
Plain Diff
sending works correctly now but format/request is still wrong
parent
11b001a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Assets/Scenes/TreeWorld_02.unity
+5
-0
5 additions, 0 deletions
Assets/Scenes/TreeWorld_02.unity
Assets/Scripts/InteractionEngine/Fact.cs
+10
-10
10 additions, 10 deletions
Assets/Scripts/InteractionEngine/Fact.cs
Assets/Scripts/JSONManager.cs
+23
-5
23 additions, 5 deletions
Assets/Scripts/JSONManager.cs
with
38 additions
and
15 deletions
Assets/Scenes/TreeWorld_02.unity
+
5
−
0
View file @
9ea37b3e
...
...
@@ -41104,6 +41104,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2089306640899292912, guid: 4d99275c6663c25469ad3b65efcd4f5f,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -0.00035664605
objectReference: {fileID: 0}
- target: {fileID: 2524590709578595355, guid: 4d99275c6663c25469ad3b65efcd4f5f,
type: 3}
propertyPath: m_AnchorMax.x
This diff is collapsed.
Click to expand it.
Assets/Scripts/InteractionEngine/Fact.cs
+
10
−
10
View file @
9ea37b3e
...
...
@@ -37,10 +37,11 @@ public static AddFactResponse sendAdd(string path, string body)
//Put constructor parses stringbody to byteArray internally (goofy workaround)
UnityWebRequest
www
=
UnityWebRequest
.
Put
(
path
,
body
);
www
.
method
=
UnityWebRequest
.
kHttpVerbPOST
;
// www.SetRequestHeader("Content-Type", "application/json");
// www.timeout = 1;
www
.
SetRequestHeader
(
"Content-Type"
,
"application/json"
);
www
.
timeout
=
1
;
//TODO: implement real asynchronous communication ...
AsyncOperation
op
=
www
.
Send
();
AsyncOperation
op
=
www
.
Send
WebRequest
();
while
(!
op
.
isDone
)
{
}
if
(
www
.
isNetworkError
||
www
.
isHttpError
)
{
...
...
@@ -60,7 +61,7 @@ public class PointFact : Fact
{
public
Vector3
Point
;
public
Vector3
Normal
;
public
string
ConceptName
=
"point"
;
public
PointFact
(
int
i
,
Vector3
P
,
Vector3
N
)
{
...
...
@@ -75,12 +76,11 @@ public PointFact(int i, Vector3 P, Vector3 N)
new
JSONManager
.
OMF
(
P
.
z
)
};
JSONManager
.
MMTTerm
tp
=
new
JSONManager
.
OMA
(
new
JSONManager
.
OMS
(
ConceptName
),
arguments
);
JSONManager
.
MMTDeclaration
mmtDecl
=
new
JSONManager
.
MMTDeclaration
()
{
label
=
"test"
,
//TODO: rework label/id ?
tp
=
tp
//JSONManager adds the id prefix
};
//OMS constructor generates full URI
JSONManager
.
MMTTerm
tp
=
new
JSONManager
.
OMS
(
"point"
);
JSONManager
.
MMTTerm
df
=
new
JSONManager
.
OMA
(
new
JSONManager
.
OMS
(
"tuple"
),
arguments
);
JSONManager
.
MMTDeclaration
mmtDecl
=
new
JSONManager
.
MMTDeclaration
(
"test"
,
tp
,
df
);
string
body
=
JSONManager
.
ToJson
(
mmtDecl
);
AddFactResponse
res
=
AddFactResponse
.
sendAdd
(
CommunicationEvents
.
ServerAdress
+
"/fact/add"
,
body
);
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/JSONManager.cs
+
23
−
5
View file @
9ea37b3e
...
...
@@ -7,7 +7,15 @@
public
static
class
JSONManager
{
public
static
string
URIPrefix
=
"http://mathhub.info/MitM/core/geometry?3DGeometry?"
;
public
static
Dictionary
<
string
,
string
>
URIDictionary
=
new
Dictionary
<
string
,
string
>
{
{
"point"
,
"http://mathhub.info/MitM/core/geometry?3DGeometry?point"
},
{
"tuple"
,
"http://gl.mathhub.info/MMT/LFX/Sigma?Symbols?Tuple"
},
{
"line"
,
"http://mathhub.info/MitM/core/geometry?Geometry/Common?line_type"
},
{
"distance"
,
"http://mathhub.info/MitM/core/geometry?Geometry/Common?lineOf"
}
};
[
JsonConverter
(
typeof
(
JsonSubtypes
),
"kind"
)]
public
class
MMTTerm
...
...
@@ -32,9 +40,12 @@ public class OMS : MMTTerm
public
string
uri
;
public
string
kind
=
"OMS"
;
public
OMS
(
string
uri
)
public
OMS
(
string
uri
,
bool
convertToURI
=
true
)
{
this
.
uri
=
URIPrefix
+
uri
;
if
(
convertToURI
)
this
.
uri
=
URIDictionary
[
uri
];
else
this
.
uri
=
uri
;
}
}
...
...
@@ -51,13 +62,13 @@ public OMF(float f)
}
}
/*
class DeclarationBody : MMTTerm
{
MMTTerm original;
MMTTerm simplified;
string kind = "O/S";
}
}
*/
public
class
MMTDeclaration
...
...
@@ -65,6 +76,13 @@ public class MMTDeclaration
public
string
label
;
public
MMTTerm
tp
;
public
MMTTerm
df
;
public
MMTDeclaration
(
string
label
,
MMTTerm
tp
,
MMTTerm
df
)
{
this
.
label
=
label
;
this
.
tp
=
tp
;
this
.
df
=
df
;
}
}
public
static
MMTDeclaration
FromJson
(
string
json
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment