Pixpro Cloud API
Pixpro Cloud API¶
Pixpro Cloud API is an API that provides methods for using Pixpro cloud processing for your projects.
Targeted frameworks: .NET Framework 4.5.2, .NET CORE 3.1
Method | Parameters | Return value | Description |
---|---|---|---|
SetUserInfo | string email, string coordinateSystemEPSG, string projectName, string returnType, bool existGCP |
void | Sets all needed information for client to proceed with processing. |
ClearCloudData | string email, string projectName, string projectId |
void | Deletes project from cloud. |
DownloadProject | string email, string projectId, string projectName, string projectPath |
void |
Downloads processed project from cloud. |
UnpackPackage | string packagePath, string unpackPath |
void | Extracts downloaded project or files. |
PackPhotos | string packagePath, List<string> photoPaths, string gcpFilePath |
void |
Packs photos for uploading. |
UploadPackage | string packagePath | void | Uploads packed photos. |
GetProjectsAsync | string email | AsyncResult<List<CloudProjectInfo>> | Returns list of projects in cloud. |
CheckStatus | string email, string projectId, string projectName |
int Return values: 0 - Finished, 1 - Proceesing, 2 - Idle. |
Returns project processing status. |
SetTestMode | void | Determines whether dll runs in test or production mode. |
Helpers for using methods via reflections for .NET Framework 4.5.2¶
These are suggested helper methods to invoke API methods via reflections.
InvokeMethod
public static object InvokeMethod(object o, string methodName, object[] arguments)
{
Type[] types = arguments.Select(x => x.GetType()).ToArray();
MethodInfo method = o.GetType().GetMethod(methodName, types);
return method.Invoke(o, arguments);
}
InvokeAsync
public static async Task<object> InvokeAsync(object o, string methodName, params object[] arguments)
{
Type[] types = arguments.Select(x => x.GetType()).ToArray();
MethodInfo method = o.GetType().GetMethod(methodName, types);
dynamic awaitable = method.Invoke(o, arguments);
await awaitable;
return awaitable.GetAwaiter().GetResult();
}
Initializing Pixpro Cloud API for .NET Framework 4.5.2¶
Pixpro.Cloud.dll needs to be be loaded and then each class needs to be initialized via System.Reflections.
Pixpro.Cloud.dll loading:
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
pDll = LoadLibrary("Pixpro.Cloud.dll")
Pixpro.Cloud.dll each class initialize:
Declare Pixpro.Cloud.PixproCloudManager class instance in CloudDllInitializer class:
private const string dllName = "Pixpro.Cloud.dll";
private static string dllAssemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static Assembly dllAssembly = Assembly.LoadFrom(Path.Combine(dllAssemblyPath, dllName));
public static dynamic CloudManagerInstance;
InitCloudManager
private static void InitCloudManager()
{
Type dllType = dllAssembly.GetType("Pixpro.Cloud.PixproCloudManager", true);
CloudManagerInstance = Activator.CreateInstance(dllType);
}
SetUserInfo¶
Sets all needed information for client to proceed with processing.
Parameters:
Parameter | Description |
---|---|
string email | Pixpro registered user email. Example user.Of.Pixpro@email.com . |
string coordinateSystemEPSG | EPSG code of the coordinate system of the project 0 for detecting automatically, '-1' for arbitrary. Example 3346 . |
string projectName | Project name. Example MyFirstPixproCloudProject . |
string returnType | Return type of processed project, if passed value "Files" than returns package with exported DensePointCloud.las, Mesh.obj, DigitalElevationMap.tif, Orthophoto.tif, Contourlines.shp otherwise returns full project. |
bool existGCP | True if there is GCP included, False there is no GCP included. |
Examples:
.NET Framework C# invoking via reflections.
public static void SetUserInfo(string email, string coordinateSystemEPSG, string projectName, string returnType, bool existGCP)
{
Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "SetUserInfoForCloudManager", new object[] { email, coordinateSystemEPSG, projectName, returnType, existGCP });
}
.NET Core C++ invoking via wrapper solution.
wrapper.SetUserInfo(email, coordinateSystemEPSG, projectName, returnType, existGCP);
Returns:
void
ClearCloudData¶
Deletes project from cloud.
Parameters:
Parameter | Description |
---|---|
string email | Pixpro registered user email. Example user.Of.Pixpro@email.com . |
string projectName | Project name. Example MyFirstPixproCloudProject . |
string projectId | File id. |
Examples:
.NET Framework C# invoking via reflections.
public static bool ClearCloudData(string email, string projectName, string projectId)
{
return (bool)Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "ClearCloudData", new object[] { email, projectName, projectId });
}
.NET Core C++ invoking via wrapper solution.
wrapper.ClearCloudData(email, projectName, projectId);
Returns:
void
Exceptions
Exception | Description |
---|---|
CloudDirectoryNotFoundException | Thrown when directory was not found in cloud. |
DownloadProject¶
Downloads processed project from cloud.
Parameters:
Parameter | Description |
---|---|
string email | Pixpro registered user email. Example user.Of.Pixpro@email.com . |
string projectId | File id. |
string projectName | Project name. Ex MyFirstPixproCloudProject . |
string projectPath | Project directory path. Example C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject . |
Examples:
.NET Framework C# invoking via reflections.
public static int DownloadProject(string email, string projectId, string projectName, string projectPath)
{
return (int)Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "DownloadProject", new object[] { email, projectId, projectName, projectPath });
}
.NET Core C++ invoking via wrapper solution.
wrapper.DownloadProject(email, projectId, projectName, projectPath);
Returns:
void
Exceptions
Exception | Description |
---|---|
CloudProjectNotFoundException | Thrown when processed project package was not found in cloud. |
PackageNotFoundException | Thrown when downloaded project package was not found. |
UnpackPackage¶
Extracts downloaded project.
Parameters:
Parameter | Description |
---|---|
string packagePath | Project package path. Example C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject\\MyFirstPixproCloudProject.zip . |
string unpackPath | Project unpack path. Example C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject . |
Examples:
.NET Framework C# invoking via reflections.
public static void UnpackPackage(string packagePath, string unpackPath)
{
Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "UnpackPackage", new object[] { packagePath, unpackPath });
}
.NET Core C++ invoking via wrapper solution.
wrapper.UnpackPackage(packagePath, unpackPath);
Returns:
void
Exceptions
Exception | Description |
---|---|
UnpackingException | Thrown when unpacking fails with inner exception. |
PackPhotos¶
Packs photos for uploading.
Parameters:
Parameter | Description |
---|---|
string packagePath | Project package path. Example C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject\\MyFirstPixproCloudProject.zip . |
List |
List of photo paths. Example [0]C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject\\Photos\\DJI_0001.jpg, [1]C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject\\Photos\\DJI_0002.jpg... . |
string gcpFilePath | GroundControlPoints.pxg file path. Example C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject\\Photos\\GroundControlPoints.pxg . |
Examples:
.NET Framework C# invoking via reflections.
public static bool PackPhotos( string packagePath, List<string> photoPaths, string gcpFilePath)
{
return (bool)Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "PackPhotos", new object[] { packagePath, photoPaths, gcpFilePath });
}
.NET Core C++ invoking via wrapper solution.
wrapper.PackPhotos(packagePath, photoPaths, gcpFilePath);
Returns:
void
Exceptions
Exception | Description |
---|---|
PhotoCountException | Thrown when photo count is under minimum value or exceeds maximum value. |
UploadPackage¶
Uploads packed photos.
Parameters:
Parameter | Description |
---|---|
string packagePath | Project package path. Example C:\\users\\admin\\documents\\Pixpro Projects\\MyFirstPixproCloudProject\\MyFirstPixproCloudProject.zip . |
Examples:
.NET Framework C# invoking via reflections.
public static string UploadPackage(string packagePath)
{
return (string)Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "UploadPackage", new object[] { packagePath });
}
.NET Core C++ invoking via wrapper solution.
wrapper.UploadPackage(packagePath);
Returns:
void
Exceptions
Exception | Description |
---|---|
CloudDirectoryNotFoundException | Thrown when directory was not found in cloud. |
CloudPackageNotFoundException | Thrown when uploaded photos package was not found in cloud. |
GetProjectsAsync¶
Returns project processing status.
Parameters:
Parameter | Description |
---|---|
string email | Pixpro registered user email. Example user.Of.Pixpro@email.com . |
Examples:
.NET Framework C# invoking via reflections.
public static async Task<Models.AsyncResult<List<Models.CloudProjectInfo>>> GetProjectsAsync(string email)
{
dynamic result = await Helpers.InvokeAsync(CloudDllInitializer.CloudManagerInstance, "GetProjectsAsync", new object[] { email });
Models.AsyncResult<List<Models.CloudProjectInfo>> resultList = new Models.AsyncResult<List<Models.CloudProjectInfo>>();
resultList.ResultCode = result.ResultCode;
resultList.Data = new List<Models.CloudProjectInfo>();
foreach (var item in result.Data)
{
resultList.Data.Add(new Models.CloudProjectInfo()
{
ExpiryDate = (DateTime)Helpers.GetPropertyValue(item, "ExpiryDate"),
PhotosSize = (long)Helpers.GetPropertyValue(item, "PhotosSize"),
Processable = (bool)Helpers.GetPropertyValue(item, "Processable"),
ProjectId = (string)Helpers.GetPropertyValue(item, "ProjectId"),
ProcessingStatus = (Models.CloudProcessingStatus)((int)Helpers.GetPropertyValue(item, "ProcessingStatus")),
ProjectName = (string)Helpers.GetPropertyValue(item, "ProjectName"),
ProjectSize = (long)Helpers.GetPropertyValue(item, "ProjectSize"),
ProjectVersion = (string)Helpers.GetPropertyValue(item, "ProjectVersion"),
ReadyStatus = (Models.CloudReadyStatus)((int)Helpers.GetPropertyValue(item, "ReadyStatus")),
Status = (Models.CloudProjectStatus)((int)Helpers.GetPropertyValue(item, "Status"))
});
}
return resultList;
}
Returns:
AsyncResult<List<CloudProjectInfo>>
CheckStatus¶
Returns project processing status.
Parameters:
Parameter | Description |
---|---|
string email | Pixpro registered user email. Example user.Of.Pixpro@email.com . |
string projectId | File id. |
string projectName | Project name. Example MyFirstPixproCloudProject . |
Examples:
.NET Framework C# invoking via reflections.
public static int CheckStatus(string email, string projectId, string projectName)
{
return (int)Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "CheckStatus", new object[] { email, projectId, projectName});
}
.NET Core C++ invoking via wrapper solution.
wrapper.CheckStatus(fileId, projectName);
Returns:
int
Returns:
0 - Finished,
1 - Proceesing,
2 - Idle..
SetTestMode¶
Determines whether dll runs in test or production mode.
Parameters:
Parameter | Description |
---|---|
bool debug | True for running in test server, False for running in production server. |
Examples:
.NET Framework C# invoking via reflections.
public static void SetDebugValue(bool debug)
{
Helpers.InvokeMethod(CloudDllInitializer.CloudManagerInstance, "SetDebugValue", new object[] { debug });
}
.NET Core C++ invoking via wrapper solution.
wrapper.SetDebugValue(true);
Returns:
void