Skip to content

Instantly share code, notes, and snippets.

View BrunoCaimar's full-sized avatar

Bruno Caimar BrunoCaimar

View GitHub Profile
@BrunoCaimar
BrunoCaimar / GeoprocessorExemplo.cs
Created October 2, 2019 14:51
AO - Exemplos Adicionar novo campo, apagar campo, renomear e calcular campo
using ESRI.ArcGIS.DataManagementTools;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geoprocessor;
using Neoenergia.ModuloProjetos.Util.Test;
using System;
using System.Runtime.InteropServices;
namespace GeoprocessorExemplo
{
@BrunoCaimar
BrunoCaimar / AddField.cs
Created September 27, 2019 20:09
Adiciona novo campo, via AO, em tabela registrada
private static void AdicionarCampo(IWorkspace workspace)
{
var table2AddField = ((IFeatureWorkspace)workspace).OpenTable("TESTE_A");
var schemaLock = (ISchemaLock)table2AddField;
try
{
schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
var newField = new FieldClass();
@BrunoCaimar
BrunoCaimar / exemplo_interval.plsql
Last active September 20, 2019 17:53
PL/SQL - Exemplo uso EXTRACT em INTERVAL
-- Exemplo de uso do EXTRACT com Interval
SELECT fj.dt_inicio, fj.dt_fim,
EXTRACT(HOUR FROM dt_fim - dt_inicio) horas,
EXTRACT(MINUTE FROM dt_fim - dt_inicio) minutos,
EXTRACT(SECOND FROM dt_fim - dt_inicio) segundos,
EXTRACT(HOUR FROM dt_fim - dt_inicio) * 60 + EXTRACT(MINUTE FROM dt_fim - dt_inicio) + EXTRACT(SECOND FROM dt_fim - dt_inicio) / 100 tempo_total
FROM
neosde.tb_fila_job fj
WHERE
nu_status > 2
@BrunoCaimar
BrunoCaimar / flip_line.cs
Created August 16, 2019 20:18
Flip line - AO
///<summary>The edit sketch direction of all of the selected polyline features is changed or flipped.</summary>
///
///<param name="application">An IApplication interface.</param>
///<param name="editor">An IEditor interface.</param>
///
///<remarks>Already must have a reference to IApplication and get the editor and start an edit session in the edit session you must have an edit selection, the code checks to make sure it is a line feature class and makes sure that there is an edit selection.</remarks>
public void FlipLineDirection(ESRI.ArcGIS.Framework.IApplication application, ESRI.ArcGIS.Editor.IEditor editor)
{
if(application == null || editor == null)
@BrunoCaimar
BrunoCaimar / GetGeographicalRadians.py
Created June 7, 2019 17:15
GetGeographicalRadians
import math
def GetGeographicalRadians(shape):
radian = math.atan2(shape.lastpoint.y - shape.firstpoint.y,
shape.lastpoint.x - shape.firstpoint.x)
if (radian<0):
radian = (radian+math.pi)*(-1)+math.pi
else:
radian=(radian-math.pi)*(-1)+math.pi
return radian
@BrunoCaimar
BrunoCaimar / GetGeographicalDegrees.cs
Created June 7, 2019 16:44
GetGeographicalDegrees
private static double GetGeographicalDegrees(IPolyline shape)
{
var radian2 = Math.Atan2(shape.ToPoint.Y - shape.FromPoint.Y,
shape.ToPoint.X - shape.FromPoint.X);
var radian = radian2 - (Math.PI / 2);//# turn minus 90°
var degrees = 0.0;
if (radian > 0)
{
degrees = 360 - (radian * 360) / (2 * Math.PI);
}
@BrunoCaimar
BrunoCaimar / ProcessInfo.cs
Created April 24, 2018 18:44
ProcessInfo.cs
using System;
using System.Collections;
using System.Collections.Generic;
namespace ConsoleAppTest
{
internal class Program
{
private static void Main(string[] args)
{
@BrunoCaimar
BrunoCaimar / msbuild.cmd
Last active April 5, 2018 12:00
MsBuild docs
Msbuild Parameters - https://msdn.microsoft.com/en-us/library/bb629394.aspx
Most Common:
- Configuration = Debug or Release
-- The configuration that you are building, either "Debug" or "Release."
- Platform = x86 or x64 or "Any CPU"
-- The operating system you are building for. Valid values are "Any CPU", "x86", and "x64".