Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
birderyu committed Jan 11, 2019
2 parents 4583679 + 42500dd commit a04d8d1
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 103 deletions.
51 changes: 44 additions & 7 deletions Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
using System.IO;
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using QuickLook.Common.Plugin;
using SharpMap.Data.Providers;
using SharpMap.Forms;
using SharpMap.Layers;
using static SharpMap.Forms.MapBox;

namespace QuickLook.Plugin.HelloWorld
{
Expand All @@ -11,30 +18,60 @@ public class Plugin : IViewer

public void Init()
{
// do nothing
}

public bool CanHandle(string path)
{
return !Directory.Exists(path) && path.ToLower().EndsWith(".zzz");
return !Directory.Exists(path) && path.ToLower().EndsWith(".shp");
}

public void Prepare(string path, ContextObject context)
{
context.PreferredSize = new Size {Width = 600, Height = 400};
context.SetPreferredSizeFit(new Size { Width = 1920, Height = 1440 }, 0.9);
}

public void View(string path, ContextObject context)
{
var viewer = new Label {Content = "I am a Label. I do nothing at all."};

context.ViewerContent = viewer;
context.Title = $"{Path.GetFileName(path)}";
try
{
MapBox mapBox = new MapBox()
{
Dock = DockStyle.Fill,
ActiveTool = Tools.Pan,
PreviewMode = PreviewModes.Fast
};
WindowsFormsHost host = new WindowsFormsHost()
{
Child = mapBox,
};
VectorLayer layer = new VectorLayer(Path.GetFileName(path))
{
DataSource = new ShapeFile(path, false, true)
};
mapBox.Map.Layers.Add(layer);
mapBox.Map.ZoomToExtents();
mapBox.Refresh();

context.IsBusy = false;
context.ViewerContent = host;
}
catch (Exception ex)
{
context.ViewerContent = new System.Windows.Controls.Label
{
Content = $"Can not open shapefile because of: {ex.Message}"
};
}
finally
{
context.IsBusy = false;
}
}

public void Cleanup()
{
// do nothing
}
}
}
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QuickLook.Plugin.HelloWorld")]
[assembly: AssemblyTitle("QuickLook.Plugin.ShapefileViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("pooi.moe")]
[assembly: AssemblyProduct("QuickLook.Plugin.HelloWorld")]
[assembly: AssemblyProduct("QuickLook.Plugin.ShapefileViewer")]
[assembly: AssemblyCopyright("Copyright © Paddy Xu 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
87 changes: 0 additions & 87 deletions QuickLook.Plugin.HelloWorld.csproj

This file was deleted.

4 changes: 2 additions & 2 deletions QuickLook.Plugin.Metadata.Base.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Metadata>
<Namespace>QuickLook.Plugin.HelloWorld</Namespace>
<Namespace>QuickLook.Plugin.ShapefileViewer</Namespace>
<Version>0</Version>
<Description>This plugin does nothing at all.</Description>
<Description>View ESRI Shapefile (*.shp).</Description>
</Metadata>
144 changes: 144 additions & 0 deletions QuickLook.Plugin.ShapefileViewer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{863ECAAC-18D9-4256-A27D-0F308089FB47}</ProjectGuid>
<OutputType>library</OutputType>
<RootNamespace>QuickLook.Plugin.ShapefileViewer</RootNamespace>
<AssemblyName>QuickLook.Plugin.ShapefileViewer</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="BruTile, Version=0.7.4.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\BruTile.0.7.4.4\lib\net40\BruTile.dll</HintPath>
</Reference>
<Reference Include="BruTile.Desktop, Version=0.7.4.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\BruTile.0.7.4.4\lib\net40\BruTile.Desktop.dll</HintPath>
</Reference>
<Reference Include="BruTile.MbTiles, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\BruTile.0.7.4.4\lib\net40\BruTile.MbTiles.dll</HintPath>
</Reference>
<Reference Include="BruTile.Serialization, Version=0.7.4.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\BruTile.0.7.4.4\lib\net40\BruTile.Serialization.dll</HintPath>
</Reference>
<Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="GeoAPI, Version=1.7.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\GeoAPI.1.7.2\lib\net403-client\GeoAPI.dll</HintPath>
</Reference>
<Reference Include="NetTopologySuite, Version=1.13.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\NetTopologySuite.1.13.2\lib\net403-client\NetTopologySuite.dll</HintPath>
</Reference>
<Reference Include="NetTopologySuite.IO.GeoTools, Version=1.13.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\NetTopologySuite.IO.1.13.2\lib\net403-client\NetTopologySuite.IO.GeoTools.dll</HintPath>
</Reference>
<Reference Include="NetTopologySuite.IO.MsSqlSpatial, Version=1.13.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\NetTopologySuite.IO.1.13.2\lib\net403-client\NetTopologySuite.IO.MsSqlSpatial.dll</HintPath>
</Reference>
<Reference Include="NetTopologySuite.IO.PostGis, Version=1.13.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\NetTopologySuite.IO.1.13.2\lib\net403-client\NetTopologySuite.IO.PostGis.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PowerCollections, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\NetTopologySuite.1.13.2\lib\net403-client\PowerCollections.dll</HintPath>
</Reference>
<Reference Include="ProjNet, Version=1.3.0.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\ProjNET4GeoAPI.1.3.0.3\lib\net403-client\ProjNet.dll</HintPath>
</Reference>
<Reference Include="SharpMap, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SharpMap.1.1.0\lib\net40-client\SharpMap.dll</HintPath>
</Reference>
<Reference Include="SharpMap.UI, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SharpMap.UI.1.1.0\lib\net40-client\SharpMap.UI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.86.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\System.Data.SQLite.MSIL.1.0.86.0\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.Linq, Version=1.0.86.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\System.Data.SQLite.MSIL.1.0.86.0\lib\net45\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="GitVersion.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="QuickLook.Common\QuickLook.Common.csproj">
<Project>{85fdd6ba-871d-46c8-bd64-f6bb0cb5ea95}</Project>
<Name>QuickLook.Common</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="QuickLook.Plugin.Metadata.Base.config" />
<None Include="QuickLook.Plugin.Metadata.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2003
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.HelloWorld", "QuickLook.Plugin.HelloWorld.csproj", "{863ECAAC-18D9-4256-A27D-0F308089FB47}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.ShapefileViewer", "QuickLook.Plugin.ShapefileViewer.csproj", "{863ECAAC-18D9-4256-A27D-0F308089FB47}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Common", "QuickLook.Common\QuickLook.Common.csproj", "{85FDD6BA-871D-46C8-BD64-F6BB0CB5EA95}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![QuickLook icon](https://user-images.githubusercontent.com/1687847/29485863-8cd61b7c-84e2-11e7-97d5-eacc2ba10d28.png)

# QuickLook.Plugin.HelloWorld
# QuickLook.Plugin.ShapefileViewer

This plugin illustrates the development process of [QuickLook](https://github.com/QL-Win/QuickLook).

Expand Down
6 changes: 3 additions & 3 deletions Scripts/pack-zip.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Remove-Item ..\QuickLook.Plugin.HelloWorld.qlplugin -ErrorAction SilentlyContinue
Remove-Item ..\QuickLook.Plugin.ShapefileViewer.qlplugin -ErrorAction SilentlyContinue

$files = Get-ChildItem -Path ..\bin\Release\ -Exclude *.pdb,*.xml
Compress-Archive $files ..\QuickLook.Plugin.HelloWorld.zip
Move-Item ..\QuickLook.Plugin.HelloWorld.zip ..\QuickLook.Plugin.HelloWorld.qlplugin
Compress-Archive $files ..\QuickLook.Plugin.ShapefileViewer.zip
Move-Item ..\QuickLook.Plugin.ShapefileViewer.zip ..\QuickLook.Plugin.ShapefileViewer.qlplugin
13 changes: 13 additions & 0 deletions packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BruTile" version="0.7.4.4" targetFramework="net462" />
<package id="Common.Logging" version="2.0.0" targetFramework="net462" />
<package id="GeoAPI" version="1.7.2" targetFramework="net462" />
<package id="NetTopologySuite" version="1.13.2" targetFramework="net462" />
<package id="NetTopologySuite.IO" version="1.13.2" targetFramework="net462" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net462" />
<package id="ProjNET4GeoAPI" version="1.3.0.3" targetFramework="net462" />
<package id="SharpMap" version="1.1.0" targetFramework="net462" />
<package id="SharpMap.UI" version="1.1.0" targetFramework="net462" />
<package id="System.Data.SQLite.MSIL" version="1.0.86.0" targetFramework="net462" />
</packages>

0 comments on commit a04d8d1

Please sign in to comment.