MaxstARSDK  3.5.0
MapViewer.cs
1 /*==============================================================================
2 Copyright 2017 Maxst, Inc. All Rights Reserved.
3 ==============================================================================*/
4 
5 using UnityEngine;
6 using System;
7 using System.Collections.Generic;
8 using System.Linq;
9 using System.Text;
10 using System.Runtime.InteropServices;
11 
12 namespace maxstAR
13 {
14  internal class MapViewer
15  {
16  private static MapViewer instance = null;
17 
18  internal static MapViewer GetInstance()
19  {
20  if (instance == null)
21  {
22  instance = new MapViewer();
23  }
24  return instance;
25  }
26 
27  private MapViewer()
28  {
29  }
30 
31  internal bool Initialize(string fileName)
32  {
33  if (Application.platform == RuntimePlatform.IPhonePlayer)
34  {
35  return NativeStaticAPI.MapViewer_initialize(fileName);
36  }
37  else
38  {
39  return NativeSharedAPI.MapViewer_initialize(fileName);
40  }
41  }
42 
43  internal void Deinitialize()
44  {
45  if (Application.platform == RuntimePlatform.IPhonePlayer)
46  {
47  NativeStaticAPI.MapViewer_deInitialize();
48  }
49  else
50  {
51  NativeSharedAPI.MapViewer_deInitialize();
52  }
53  }
54 
55  internal IntPtr GetJson()
56  {
57  if (Application.platform == RuntimePlatform.IPhonePlayer)
58  {
59  return NativeStaticAPI.MapViewer_getJson();
60  }
61  else
62  {
63  return NativeSharedAPI.MapViewer_getJson();
64  }
65  }
66 
67  internal int Create(int idx)
68  {
69  if (Application.platform == RuntimePlatform.IPhonePlayer)
70  {
71  return NativeStaticAPI.MapViewer_create(idx);
72  }
73  else
74  {
75  return NativeSharedAPI.MapViewer_create(idx);
76  }
77  }
78 
79  internal void GetIndices(out int indices)
80  {
81  if (Application.platform == RuntimePlatform.IPhonePlayer)
82  {
83  NativeStaticAPI.MapViewer_getIndices(out indices);
84  }
85  else
86  {
87  NativeSharedAPI.MapViewer_getIndices(out indices);
88  }
89  }
90 
91  internal void GetTexCoords(out float texCoords)
92  {
93  if (Application.platform == RuntimePlatform.IPhonePlayer)
94  {
95  NativeStaticAPI.MapViewer_getTexCoords(out texCoords);
96  }
97  else
98  {
99  NativeSharedAPI.MapViewer_getTexCoords(out texCoords);
100  }
101  }
102 
103  internal int GetImageSize(int idx)
104  {
105  if (Application.platform == RuntimePlatform.IPhonePlayer)
106  {
107  return NativeStaticAPI.MapViewer_getImageSize(idx);
108  }
109  else
110  {
111  return NativeSharedAPI.MapViewer_getImageSize(idx);
112  }
113  }
114 
115  internal void GetImage(int idx, out byte image)
116  {
117  if (Application.platform == RuntimePlatform.IPhonePlayer)
118  {
119  NativeStaticAPI.MapViewer_getImage(idx, out image);
120  }
121  else
122  {
123  NativeSharedAPI.MapViewer_getImage(idx, out image);
124  }
125  }
126  }
127 }