/// <summary> /// Once the parameters have been configured the Execute command can be called, it returns true if successful /// </summary> public override bool Execute(ICancelProgressHandler cancelProgressHandler) { IFeatureSet input1 = _inputParam[0].Value as IFeatureSet; if (input1 != null) { input1.FillAttributes(); } ProjectionParam source = _inputParam[1] as ProjectionParam; ProjectionParam dest = _inputParam[2] as ProjectionParam; ProjectionInfo pSource = null; if (source != null) { pSource = source.Value; } if (dest == null) { return(false); } IFeatureSet output = _outputParam[0].Value as IFeatureSet; return(Execute(input1, pSource, dest.Value, output, cancelProgressHandler)); }
/// <summary> /// The parameters array should be populated with default values here. /// </summary> public override void Initialize() { _inputParam = new Parameter[3]; _inputParam[0] = new FeatureSetParam(TextStrings.InputFeatureSet) { HelpText = TextStrings.InputFeatureSettoreproject }; _inputParam[1] = new ProjectionParam(TextStrings.SourceProjection) { HelpText = TextStrings.sourceprojectiondifferent }; _inputParam[2] = new ProjectionParam(TextStrings.DesiredOutputProjection) { HelpText = TextStrings.Thedestinationprojection }; _outputParam = new Parameter[2]; _outputParam[0] = new FeatureSetParam(TextStrings.OutputFeatureSet) { HelpText = TextStrings.SelectResultFeatureSetDirectory }; _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true); }
/// <summary> /// Changes the projection of this param via the ProjectionSelectDialog. /// </summary> /// <param name="sender">Sender that raised the event.</param> /// <param name="e">The event args.</param> private void CmdSelectClick(object sender, EventArgs e) { using ProjectionSelectDialog dlg = new(); if (dlg.ShowDialog() != DialogResult.OK) { return; } if (Param == null) { Param = new ProjectionParam("destination projection", dlg.SelectedCoordinateSystem); } else { Param.Value = dlg.SelectedCoordinateSystem; } }
/// <summary> /// Creates a new instance of ProjectionElement /// </summary> public ProjectionElement(ProjectionParam value) { _tthelp = new ToolTip(); base.Param = value; InitializeComponent(); if (value == null) { return; } GroupBox.Text = value.Name; if (value.Value != null) { lblProjection.Text = value.Value.ToProj4String(); } value.ValueChanged += ParamValueChanged; }
/// <summary> /// Once the parameters have been configured the Execute command can be called, it returns true if successful. /// </summary> /// <param name="cancelProgressHandler">The progress handler.</param> /// <returns>True, if executed successfully.</returns> public override bool Execute(ICancelProgressHandler cancelProgressHandler) { IFeatureSet input1 = _inputParam[0].Value as IFeatureSet; input1?.FillAttributes(); ProjectionParam source = _inputParam[1] as ProjectionParam; ProjectionInfo pSource = source?.Value; if (!(_inputParam[2] is ProjectionParam dest)) { return(false); } IFeatureSet output = _outputParam[0].Value as IFeatureSet; return(Execute(input1, pSource, dest.Value, output, cancelProgressHandler)); }
private void CmdSelectClick(object sender, EventArgs e) { ProjectionSelectDialog dlg = new ProjectionSelectDialog(); if (dlg.ShowDialog() != DialogResult.OK) { return; } if (Param == null) { Param = new ProjectionParam("destination projection", dlg.SelectedCoordinateSystem); } else { Param.Value = dlg.SelectedCoordinateSystem; } lblProjection.Text = Param.Value.ToProj4String(); _tthelp.SetToolTip(lblProjection, Param.Value.ToProj4String()); }
public void HandleObjectExtraParams(Message m) { const ushort FlexiEP = 0x10; const ushort LightEP = 0x20; const ushort SculptEP = 0x30; const ushort ProjectionEP = 0x40; const ushort ExtendedMeshEP = 0x70; var req = (ObjectExtraParams)m; if (req.CircuitSessionID != req.SessionID || req.CircuitAgentID != req.AgentID) { return; } IAgent agent; if (!Agents.TryGetValue(req.AgentID, out agent)) { return; } foreach (var data in req.ObjectData) { #if DEBUG m_Log.DebugFormat("ObjectExtraParams localid={0}", data.ObjectLocalID); #endif ObjectPart part; if (!Primitives.TryGetValue(data.ObjectLocalID, out part)) { continue; } if (!CanEdit(agent, part.ObjectGroup, part.ObjectGroup.GlobalPosition)) { continue; } switch (data.ParamType) { case FlexiEP: if (!data.ParamInUse) { FlexibleParam flexi = part.Flexible; flexi.IsFlexible = false; part.Flexible = flexi; } else { part.Flexible = FlexibleParam.FromUdpDataBlock(data.ParamData); } break; case LightEP: if (!data.ParamInUse) { PointLightParam light = part.PointLight; light.IsLight = false; part.PointLight = light; } else { part.PointLight = PointLightParam.FromUdpDataBlock(data.ParamData); } break; case SculptEP: if (data.ParamInUse && data.ParamData.Length >= 17) { byte[] param = data.ParamData; ObjectPart.PrimitiveShape shape = part.Shape; shape.SculptMap = new UUID(param, 0); shape.SculptType = (PrimitiveSculptType)(param[16] & 0x3F); shape.IsSculptInverted = (param[16] & 0x40) != 0; shape.IsSculptMirrored = (param[16] & 0x80) != 0; part.Shape = shape; } break; case ProjectionEP: if (!data.ParamInUse) { ProjectionParam proj = part.Projection; proj.IsProjecting = false; part.Projection = proj; } else { part.Projection = ProjectionParam.FromUdpDataBlock(data.ParamData); } break; case ExtendedMeshEP: if (!data.ParamInUse) { ExtendedMeshParams mesh = part.ExtendedMesh; mesh.Flags = ExtendedMeshParams.MeshFlags.None; part.ExtendedMesh = mesh; } else { part.ExtendedMesh = ExtendedMeshParams.FromUdpDataBlock(data.ParamData); } break; } } }
/// <summary> /// Initializes a new instance of the <see cref="ProjectionElement"/> class. /// </summary> /// <param name="value">The ProjectionParam.</param> public ProjectionElement(ProjectionParam value) { base.Param = value; InitializeComponent(); DoRefresh(); }
public void EnumerateUsedAssets(Action <UUID> action) { using (var conn = new NpgsqlConnection(m_ConnectionString)) { conn.Open(); using (var cmd = new NpgsqlCommand("SELECT DISTINCT \"AssetId\" FROM primitems", conn)) { using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { action(dbReader.GetUUID("AssetId")); } } } using (var cmd = new NpgsqlCommand("SELECT \"EnvironmentSettings\" FROM environmentsettings", conn)) { using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { WindLightSettings settings; using (MemoryStream ms = new MemoryStream(dbReader.GetBytes("EnvironmentSettings"))) { settings = WindLightSettings.Deserialize(ms); } if (settings.WaterSettings.NormalMap != UUID.Zero) { action(settings.WaterSettings.NormalMap); } } } } using (var cmd = new NpgsqlCommand("SELECT DISTINCT \"NormalMapTexture\" FROM lightshare", conn)) { using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { UUID id = dbReader.GetUUID("NormalMapTexture"); if (id != UUID.Zero) { action(id); } } } } using (var cmd = new NpgsqlCommand("SELECT DISTINCT \"TerrainTexture1\", \"TerrainTexture2\", \"TerrainTexture3\", \"TerrainTexture4\" FROM regionsettings", conn)) { using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { UUID id; id = dbReader.GetUUID("TerrainTexture1"); if (id != UUID.Zero) { action(id); } id = dbReader.GetUUID("TerrainTexture2"); if (id != UUID.Zero) { action(id); } id = dbReader.GetUUID("TerrainTexture3"); if (id != UUID.Zero) { action(id); } id = dbReader.GetUUID("TerrainTexture4"); if (id != UUID.Zero) { action(id); } } } } using (var cmd = new NpgsqlCommand("SELECT \"PrimitiveShapeData\", \"ParticleSystem\", \"TextureEntryBytes\", \"ProjectionData\", \"LoopedSoundData\", \"ImpactSoundData\" FROM prims", conn)) { using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { var shape = new ObjectPart.PrimitiveShape { Serialization = dbReader.GetBytes("PrimitiveShapeData") }; var particleSystem = new ParticleSystem(dbReader.GetBytes("ParticleSystem"), 0); var te = new TextureEntry(dbReader.GetBytes("TextureEntryBytes")); var proj = new ProjectionParam { DbSerialization = dbReader.GetBytes("ProjectionData") }; var sound = new SoundParam { Serialization = dbReader.GetBytes("LoopedSoundData") }; var colsound = new CollisionSoundParam { Serialization = dbReader.GetBytes("ImpactSoundData") }; if (shape.SculptMap != UUID.Zero) { action(shape.SculptMap); } foreach (UUID refid in particleSystem.References) { if (refid != UUID.Zero) { action(refid); } } foreach (UUID refid in te.References) { if (refid != UUID.Zero) { action(refid); } } if (proj.ProjectionTextureID != UUID.Zero) { action(proj.ProjectionTextureID); } if (sound.SoundID != UUID.Zero) { action(sound.SoundID); } if (colsound.ImpactSound != UUID.Zero) { action(colsound.ImpactSound); } } } } } }